Interface DomainMapperManager
-
- All Superinterfaces:
DomainMapper
,PostMapper
- All Known Implementing Classes:
DefaultDomainMapperManager
public interface DomainMapperManager extends DomainMapper, PostMapper
Manages one or moreDomainMapperMember
instances as a transformation pipeline between domain types. Often used byCrudEntityService
implementations to convert between repository domain class instances and their respective business domain instances (or vice versa).DomainMapperManager may be used regardless of the backing repository plaform. It is agnostic to the backing domain class type (or backing repository). If not using out-of-the-box ModelMapper support, individual
DomainMapperMember
instances may be employed to handle repository specific mapping use cases.An entity implementation will generally define a mapping approach between the repository domain class and the business domain class. See
ModelMapperMappable
, which should be implemented by top level repository domain class implementations when using the out-of-the-box support provided byModelMapperDomainMapperMember
. DifferentDomainMapperMember
instances may be used to achieve transformation via a different mapping approach.- Author:
- Jeff Fischer
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default <P> P
convertFromPersistentDomain(Object domain, ContextInfo contextInfo)
Similar tofromRepositoryDomain(Object, Class, ContextInfo)
, but doesn't require the caller to know the business domain type.default <D> D
fromBusinessDomain(Object businessDomain, Class<D> repositoryDomainType, ContextInfo contextInfo)
Map and return a populated repository domain class instance, based on information provided in a business domain instance.<P> P
fromRepositoryDomain(BusinessTypeAware repositoryDomain, ContextInfo contextInfo)
Map and return a populated business domain instance, based on information provided in a repository domain instance.default <P> P
fromRepositoryDomain(Object repositoryDomain, Class<P> businessDomainType, ContextInfo contextInfo)
Map and return a populated business domain instance, based on information provided in a repository domain instance.default <P> P
fromRepositoryDomainByExample(Object repositoryDomain, P example, ContextInfo contextInfo)
Map and return a populated business domain instance, based on information provided in a repository domain instance.com.broadleafcommerce.common.extension.TypeFactory
getTypeFactory()
<P> P
process(Object repositoryDomain, ContextInfo contextInfo)
Execute both theDomainMapperMember.fromRepositoryDomain(Object, Object, ContextInfo)
pipeline andPostMapper.transform(Object, Object, ContextInfo)
pipeline in a single call.<P> List<P>
process(List<?> repositoryDomain, ContextInfo contextInfo)
Execute both theDomainMapperMember.fromRepositoryDomain(Object, Object, ContextInfo)
pipeline andPostMapper.transform(List, List, ContextInfo)
pipeline in a single call.<P> Stream<P>
process(Stream<?> repositoryDomain, ContextInfo contextInfo)
Execute both theDomainMapperMember.fromRepositoryDomain(Object, Object, ContextInfo)
pipeline andPostMapper.transform(List, List, ContextInfo)
pipeline in a single call.<P> org.springframework.data.domain.Page<P>
process(org.springframework.data.domain.Page<?> repositoryDomain, ContextInfo contextInfo)
Execute both theDomainMapperMember.fromRepositoryDomain(Object, Object, ContextInfo)
pipeline andPostMapper.transform(List, List, ContextInfo)
pipeline in a single call.-
Methods inherited from interface com.broadleafcommerce.data.tracking.core.mapping.DomainMapper
deleteMap, getBusinessDomainType, modifyMap
-
Methods inherited from interface com.broadleafcommerce.data.tracking.core.mapping.PostMapper
transform, transform
-
-
-
-
Method Detail
-
fromBusinessDomain
@Nullable default <D> D fromBusinessDomain(Object businessDomain, Class<D> repositoryDomainType, @Nullable ContextInfo contextInfo)
Map and return a populated repository domain class instance, based on information provided in a business domain instance. Usually delegates toDomainMapperMember.fromBusinessDomain(Object, Object, ContextInfo)
.- Type Parameters:
D
- The repository domain type- Parameters:
businessDomain
- The business instance containing the relevant property informationrepositoryDomainType
- The class defining the persisted domain type to returncontextInfo
- The context information used to make tracking determinations relevant to sandboxing and multitenant concerns. SeeTrackableRepository
for more info on persistence behavior based on context.- Returns:
- The populated repository domain instance. Should return null if no action taken.
-
fromRepositoryDomain
@Nullable default <P> P fromRepositoryDomain(Object repositoryDomain, Class<P> businessDomainType, @Nullable ContextInfo contextInfo)
Map and return a populated business domain instance, based on information provided in a repository domain instance. Usually delegates toDomainMapperMember.fromRepositoryDomain(Object, Object, ContextInfo)
.- Type Parameters:
P
- The business domain type- Parameters:
repositoryDomain
- The persistence-based domain instance containing the relevant property informationbusinessDomainType
- The class defining the business domain type to returncontextInfo
- The context information used to make tracking determinations relevant to sandboxing and multitenant concerns. SeeTrackableRepository
for more info on persistence behavior based on context.- Returns:
- The populated business domain instance. Should return null if no action taken.
-
fromRepositoryDomainByExample
@Nullable default <P> P fromRepositoryDomainByExample(Object repositoryDomain, P example, @Nullable ContextInfo contextInfo)
Map and return a populated business domain instance, based on information provided in a repository domain instance. Usually delegates toDomainMapperMember.fromRepositoryDomain(Object, Object, ContextInfo)
.- Type Parameters:
P
- The business domain type- Parameters:
repositoryDomain
- The persistence-based domain instance containing the relevant property informationexample
- The business domain instancecontextInfo
- The context information used to make tracking determinations relevant to sandboxing and multitenant concerns. SeeTrackableRepository
for more info on persistence behavior based on context.- Returns:
- The populated business domain instance. Should return null if no action taken.
-
fromRepositoryDomain
<P> P fromRepositoryDomain(BusinessTypeAware repositoryDomain, ContextInfo contextInfo)
Map and return a populated business domain instance, based on information provided in a repository domain instance. Usually delegates toDomainMapperMember.fromRepositoryDomain(Object, Object, ContextInfo)
.- Type Parameters:
P
- The business domain type- Parameters:
repositoryDomain
- The persistence-based domain instance containing the relevant property information. This instance can produce the business domain type.contextInfo
- The context information used to make tracking determinations relevant to sandboxing and multitenant concerns. SeeTrackableRepository
for more info on persistence behavior based on context.- Returns:
- The populated business domain instance. Should return null if no action taken.
-
process
<P> P process(Object repositoryDomain, ContextInfo contextInfo)
Execute both theDomainMapperMember.fromRepositoryDomain(Object, Object, ContextInfo)
pipeline andPostMapper.transform(Object, Object, ContextInfo)
pipeline in a single call.- Type Parameters:
P
- The projection type- Parameters:
repositoryDomain
- The originating repository domain instancecontextInfo
- The context information used to make tracking determinations relevant to sandboxing and multitenant concerns. SeeTrackableRepository
for more info on persistence behavior based on context.- Returns:
- The mapped and transformed projection
-
process
<P> Stream<P> process(Stream<?> repositoryDomain, ContextInfo contextInfo)
Execute both theDomainMapperMember.fromRepositoryDomain(Object, Object, ContextInfo)
pipeline andPostMapper.transform(List, List, ContextInfo)
pipeline in a single call.- Type Parameters:
P
- The projection type- Parameters:
repositoryDomain
- The originating repository domain instances in the form of a streamcontextInfo
- The context information used to make tracking determinations relevant to sandboxing and multitenant concerns. SeeTrackableRepository
for more info on persistence behavior based on context.- Returns:
- The mapped and transformed stream of projection instances
-
process
<P> List<P> process(List<?> repositoryDomain, ContextInfo contextInfo)
Execute both theDomainMapperMember.fromRepositoryDomain(Object, Object, ContextInfo)
pipeline andPostMapper.transform(List, List, ContextInfo)
pipeline in a single call.- Type Parameters:
P
- The projection type- Parameters:
repositoryDomain
- The originating repository domain instances in the form of a listcontextInfo
- The context information used to make tracking determinations relevant to sandboxing and multitenant concerns. SeeTrackableRepository
for more info on persistence behavior based on context.- Returns:
- The mapped and transformed list of projection instances
-
process
<P> org.springframework.data.domain.Page<P> process(org.springframework.data.domain.Page<?> repositoryDomain, ContextInfo contextInfo)
Execute both theDomainMapperMember.fromRepositoryDomain(Object, Object, ContextInfo)
pipeline andPostMapper.transform(List, List, ContextInfo)
pipeline in a single call.- Type Parameters:
P
- The projection type- Parameters:
repositoryDomain
- The originating repository domain instances in the form of a page of content.contextInfo
- The context information used to make tracking determinations relevant to sandboxing and multitenant concerns. SeeTrackableRepository
for more info on persistence behavior based on context.- Returns:
- The mapped and transformed page of projection instances
-
convertFromPersistentDomain
@Nullable default <P> P convertFromPersistentDomain(Object domain, @Nullable ContextInfo contextInfo)
Similar tofromRepositoryDomain(Object, Class, ContextInfo)
, but doesn't require the caller to know the business domain type. In effect, this call combines theDomainMapper.getBusinessDomainType(Object)
andfromRepositoryDomain(Object, Class, ContextInfo)
into a single call.- Parameters:
domain
- The repository domain instancecontextInfo
- Optional context information. Useful if the domain param isTrackable
.- Returns:
- The converted business domain instance
-
getTypeFactory
com.broadleafcommerce.common.extension.TypeFactory getTypeFactory()
-
-