public abstract class AbstractSetTypeConverter extends Object implements TypeConverter<Set,Set>, Named, NeedsJTransfo
Set objects. You need to define the to object contents for the set.| Constructor and Description |
|---|
AbstractSetTypeConverter(String name,
Class<?> toType)
Construct type converter for converting a set, assign given name and use given transfer object type.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
canConvert(Type realToType,
Type realDomainType)
Can this type converter handle conversions between the given transfer and domain object types?
|
Set |
convert(Set toObjects,
SyntheticField domainField,
Object domainObject,
String... tags)
Convert a transfer object field value to the value for the domain object.
|
abstract Object |
doConvertOne(JTransfo jTransfo,
Object toObject,
Class<?> domainObjectType,
String... tags)
Do the actual conversion of one object.
|
Object |
doReverseOne(JTransfo jTransfo,
Object domainObject,
SyntheticField toField,
Class<?> toType,
String... tags)
Do the actual reverse conversion of one object.
|
String |
getName()
Get name for the object.
|
Set |
reverse(Set domainObjects,
SyntheticField toField,
Object toObject,
String... tags)
Convert a domain object field value to the value for the transfer object.
|
void |
setAlwaysNewSet(boolean alwaysNewSet)
Set whether a new set should be used as container for the values.
|
void |
setEmptySetSupplier(Supplier<Set> emptySetSupplier)
Define a supplier for empty sets.
|
void |
setJTransfo(JTransfo jTransfo)
Set jTransfo instance which can be used recursively.
|
void |
setKeepNullSet(boolean keepNullSet)
Set whether null values should be kept (true).
|
public AbstractSetTypeConverter(String name, Class<?> toType)
name - name for type converter, for use in MappedBy.typeConverter()toType - transfer object typepublic void setJTransfo(JTransfo jTransfo)
NeedsJTransfosetJTransfo in interface NeedsJTransfojTransfo - jTransfo instancepublic boolean canConvert(Type realToType, Type realDomainType)
TypeConvertercanConvert in interface TypeConverter<Set,Set>realToType - real class for the type in the transfer objectrealDomainType - real class for the type in the domain objectpublic abstract Object doConvertOne(JTransfo jTransfo, Object toObject, Class<?> domainObjectType, String... tags) throws JTransfoException
jTransfo - jTransfo instance in usetoObject - transfer objectdomainObjectType - domain object typetags - tags which indicate which fields can be converted based on MapOnly annotations.JTransfoException - oops, cannot convertpublic Set convert(Set toObjects, SyntheticField domainField, Object domainObject, String... tags) throws JTransfoException
TypeConverterconvert in interface TypeConverter<Set,Set>toObjects - object to convertdomainField - target domain fielddomainObject - target domain objecttags - tags which indicate which fields can be converted based on MapOnly annotations.JTransfoException - problem during type conversionpublic Object doReverseOne(JTransfo jTransfo, Object domainObject, SyntheticField toField, Class<?> toType, String... tags) throws JTransfoException
jTransfo - jTransfo instance in usedomainObject - domain objecttoField - field definition on the transfer objecttoType - configured to type for listtags - tags which indicate which fields can be converted based on MapOnly annotations.JTransfoException - oops, cannot convertpublic Set reverse(Set domainObjects, SyntheticField toField, Object toObject, String... tags) throws JTransfoException
TypeConverterreverse in interface TypeConverter<Set,Set>domainObjects - object to converttoField - target transfer object fieldtoObject - target transfer objecttags - tags which indicate which fields can be converted based on MapOnly annotations.JTransfoException - problem during type conversionpublic void setKeepNullSet(boolean keepNullSet)
keepNullSet - should null be kept as value or replaced by an empty set.public void setAlwaysNewSet(boolean alwaysNewSet)
alwaysNewSet - should null be kept as value or replaced by an empty list.Copyright © 2017. All rights reserved.