Module org.eclipse.persistence.moxy
Package org.eclipse.persistence.jaxb
Class JAXBTypesafeEnumConverter
java.lang.Object
org.eclipse.persistence.jaxb.JAXBTypesafeEnumConverter
- All Implemented Interfaces:
Serializable
,CoreConverter<DatabaseMapping,
,Session> Converter
Purpose: JAXBTypesafeEnumConverter is used to allow mapping to type safe
enums according to the JAXB 1.0 spec. Object values are not modified by the converter
when writing data values. Data values are read in and the "fromString" method on
the enumeration class is invoked with the data value as a parameter. The return value from
the "fromString" method will be an instance of the enum class specified on the mapping.
- See Also:
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionconvertDataValueToObjectValue
(Object dataValue, Session session) INTERNAL: The fromString value on the enum class must be invoked with the field value specified as an argument.convertObjectValueToDataValue
(Object objectValue, Session session) INTERNAL: Return the attribute value.Class
<?> PUBLIC: Get the class which was set as the enum class which contains the fromValue method.PUBLIC: Get the name of the enum class which contains the fromValue method.void
initialize
(DatabaseMapping mapping, Session session) INTERNAL: Set the enum class.boolean
PUBLIC: If the converter converts the value to a mutable value, i.e.void
setEnumClass
(Class<?> enumClass) PUBLIC: Set the enum class to know which class to invoke the fromValue method on.void
setEnumClassName
(String newClassName) PUBLIC: Set the name of the enum class to know which class to invoke the fromValue method on.
-
Constructor Details
-
JAXBTypesafeEnumConverter
public JAXBTypesafeEnumConverter()PUBLIC: Default constructor.
-
-
Method Details
-
convertObjectValueToDataValue
INTERNAL: Return the attribute value.- Specified by:
convertObjectValueToDataValue
in interfaceConverter
- Specified by:
convertObjectValueToDataValue
in interfaceCoreConverter<DatabaseMapping,
Session>
-
convertDataValueToObjectValue
INTERNAL: The fromString value on the enum class must be invoked with the field value specified as an argument. The result returned should be an instance of the enum class.- Specified by:
convertDataValueToObjectValue
in interfaceConverter
- Specified by:
convertDataValueToObjectValue
in interfaceCoreConverter<DatabaseMapping,
Session>
-
isMutable
public boolean isMutable()Description copied from interface:Converter
PUBLIC: If the converter converts the value to a mutable value, i.e. a value that can have its' parts changed without being replaced, then it must return true. If the value is not mutable, cannot be changed without replacing the whole value then false must be returned. This is used within the UnitOfWork to determine how to clone. -
initialize
INTERNAL: Set the enum class.- Specified by:
initialize
in interfaceConverter
- Specified by:
initialize
in interfaceCoreConverter<DatabaseMapping,
Session>
-
getEnumClassName
PUBLIC: Get the name of the enum class which contains the fromValue method. -
setEnumClassName
PUBLIC: Set the name of the enum class to know which class to invoke the fromValue method on. -
setEnumClass
PUBLIC: Set the enum class to know which class to invoke the fromValue method on. -
getEnumClass
PUBLIC: Get the class which was set as the enum class which contains the fromValue method.
-