public class ReadOnlyDomainAutomaticTypeConverter extends AbstractToDomainTypeConverter implements Named, NeedsJTransfo
ReadOnlyDomainAutomaticListTypeConverter
in that case.Constructor and Description |
---|
ReadOnlyDomainAutomaticTypeConverter() |
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?
|
Object |
convert(Object toObject,
SyntheticField domainField,
Object domainObject,
String... tags)
Convert a transfer object field value to the value for the domain object.
|
Object |
doConvert(JTransfo jTransfo,
Object toObject,
SyntheticField domainField,
String... tags)
Do the actual conversion.
|
String |
getName()
Get name for the object.
|
Object |
reverse(Object domainObject,
SyntheticField toField,
Object toObject,
String... tags)
Convert a domain object field value to the value for the transfer object.
|
void |
setAlwaysNewList(boolean alwaysNewList)
Set whether a new list should be used as container for the values.
|
void |
setAlwaysNewSet(boolean alwaysNewSet)
Set whether a new set should be used as container for the values.
|
void |
setJTransfo(JTransfo jTransfo)
Set jTransfo instance which can be used recursively.
|
void |
setKeepNullList(boolean keepNullList)
Set whether null values should be kept (true).
|
void |
setKeepNullSet(boolean keepNullSet)
Set whether null values should be kept (true).
|
void |
setName(String name)
Set the name for the type converter.
|
void |
setSortList(boolean sortList)
Should the list be sorted if the first member is Comparable?
|
public ReadOnlyDomainAutomaticTypeConverter()
public void setJTransfo(JTransfo jTransfo)
NeedsJTransfo
setJTransfo
in interface NeedsJTransfo
setJTransfo
in class AbstractToDomainTypeConverter
jTransfo
- jTransfo instancepublic boolean canConvert(Type realToType, Type realDomainType)
TypeConverter
canConvert
in interface TypeConverter<Object,Object>
canConvert
in class AbstractToDomainTypeConverter
realToType
- real class for the type in the transfer objectrealDomainType
- real class for the type in the domain objectpublic Object convert(Object toObject, SyntheticField domainField, Object domainObject, String... tags) throws JTransfoException
TypeConverter
convert
in interface TypeConverter<Object,Object>
convert
in class AbstractToDomainTypeConverter
toObject
- 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 reverse(Object domainObject, SyntheticField toField, Object toObject, String... tags) throws JTransfoException
TypeConverter
reverse
in interface TypeConverter<Object,Object>
reverse
in class AbstractToDomainTypeConverter
domainObject
- 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 Object doConvert(JTransfo jTransfo, Object toObject, SyntheticField domainField, String... tags) throws JTransfoException
AbstractToDomainTypeConverter
doConvert
in class AbstractToDomainTypeConverter
jTransfo
- jTransfo instance in usetoObject
- transfer objectdomainField
- domain object fieldtags
- tags which indicate which fields can be converted based on MapOnly
annotations.JTransfoException
- oops, cannot convertpublic void setName(String name)
name
- type converter namepublic void setKeepNullList(boolean keepNullList)
keepNullList
- should null be kept as value or replaced by an empty list.public void setKeepNullSet(boolean keepNullSet)
keepNullSet
- should null be kept as value or replaced by an empty set.public void setAlwaysNewList(boolean alwaysNewList)
alwaysNewList
- should null be kept as value or replaced by an empty list.public void setAlwaysNewSet(boolean alwaysNewSet)
alwaysNewSet
- should null be kept as value or replaced by an empty set.public void setSortList(boolean sortList)
sortList
- true when list should be sortedCopyright © 2022. All rights reserved.