public interface ToEntityConverter
UnitOfWork.toEntity(Class, HasIdentity)
.
The implementation of this interface should be registered as metaInfo on the Usecase
of the UnitOfWork
where the conversion should take place. It is also possible to register
the implementation to the UnitOfWork
's metaInfo.
Example;
private static final Usecase USECASE_GET_USER_DETAILS = UseCaseBuilder
.buildUseCase("get user details")
.withMetaInfo( new UserToEntityConverter() )
.newUsecase();
@Structure
private UnitOfWorkFactory uowf;
:
:
try( UnitOfWork uow = uowf.newUnitOfWork( USECASE_GET_USER_DETAILS ) )
{
:
User value = ...;
User entity = uow.toEntity( User.class, value );
:
}
:
:
Modifier and Type | Method and Description |
---|---|
Function<AssociationDescriptor,EntityReference> |
associations(Object entityComposite,
Function<AssociationDescriptor,EntityReference> defaultFn)
Returns the Function to convert each of the associations of the entities into the value.
|
Function<AssociationDescriptor,Stream<EntityReference>> |
manyAssociations(Object entityComposite,
Function<AssociationDescriptor,Stream<EntityReference>> defaultFn)
Returns the Function to convert each of the manyAssociations of the entities into the value.
|
Function<AssociationDescriptor,Stream<Map.Entry<String,EntityReference>>> |
namedAssociations(Object entityComposite,
Function<AssociationDescriptor,Stream<Map.Entry<String,EntityReference>>> defaultFn)
Returns the Function to convert each of the NamedAssociations of the entities into the value.
|
Function<PropertyDescriptor,Object> |
properties(Object entityComposite,
Function<PropertyDescriptor,Object> defaultFn)
Returns the Function to convert each of the properties of the entities into the value.
|
Function<PropertyDescriptor,Object> properties(Object entityComposite, Function<PropertyDescriptor,Object> defaultFn)
entityComposite
- the entity that is to be converted.defaultFn
- The default converter function. This can be used to delegate non-special cases, or simply
return to do all the conversionsFunction<AssociationDescriptor,EntityReference> associations(Object entityComposite, Function<AssociationDescriptor,EntityReference> defaultFn)
entityComposite
- the entity that is to be converted.defaultFn
- The default converter function. This can be used to delegate non-special cases, or simply
return to do all the conversionsFunction<AssociationDescriptor,Stream<EntityReference>> manyAssociations(Object entityComposite, Function<AssociationDescriptor,Stream<EntityReference>> defaultFn)
entityComposite
- the entity that is to be converted.defaultFn
- The default converter function. This can be used to delegate non-special cases, or simply
return to do all the conversionsFunction<AssociationDescriptor,Stream<Map.Entry<String,EntityReference>>> namedAssociations(Object entityComposite, Function<AssociationDescriptor,Stream<Map.Entry<String,EntityReference>>> defaultFn)
entityComposite
- the entity that is to be converted.defaultFn
- The default converter function. This can be used to delegate non-special cases, or simply
return to do all the conversions