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
public class JAXBTypesafeEnumConverter extends Object implements 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:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description JAXBTypesafeEnumConverter()PUBLIC: Default constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ObjectconvertDataValueToObjectValue(Object dataValue, Session session)INTERNAL: The fromString value on the enum class must be invoked with the field value specified as an argument.ObjectconvertObjectValueToDataValue(Object objectValue, Session session)INTERNAL: Return the attribute value.Class<?>getEnumClass()PUBLIC: Get the class which was set as the enum class which contains the fromValue method.StringgetEnumClassName()PUBLIC: Get the name of the enum class which contains the fromValue method.voidinitialize(DatabaseMapping mapping, Session session)INTERNAL: Set the enum class.booleanisMutable()voidsetEnumClass(Class<?> enumClass)PUBLIC: Set the enum class to know which class to invoke the fromValue method on.voidsetEnumClassName(String newClassName)PUBLIC: Set the name of the enum class to know which class to invoke the fromValue method on.
-
-
-
Method Detail
-
convertObjectValueToDataValue
public Object convertObjectValueToDataValue(Object objectValue, Session session)
INTERNAL: Return the attribute value.- Specified by:
convertObjectValueToDataValuein interfaceConverter- Specified by:
convertObjectValueToDataValuein interfaceCoreConverter<DatabaseMapping,Session>
-
convertDataValueToObjectValue
public Object convertDataValueToObjectValue(Object dataValue, Session session)
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:
convertDataValueToObjectValuein interfaceConverter- Specified by:
convertDataValueToObjectValuein interfaceCoreConverter<DatabaseMapping,Session>
-
initialize
public void initialize(DatabaseMapping mapping, Session session)
INTERNAL: Set the enum class.- Specified by:
initializein interfaceConverter- Specified by:
initializein interfaceCoreConverter<DatabaseMapping,Session>
-
getEnumClassName
public String getEnumClassName()
PUBLIC: Get the name of the enum class which contains the fromValue method.
-
setEnumClassName
public void setEnumClassName(String newClassName)
PUBLIC: Set the name of the enum class to know which class to invoke the fromValue method on.
-
setEnumClass
public void setEnumClass(Class<?> enumClass)
PUBLIC: Set the enum class to know which class to invoke the fromValue method on.
-
getEnumClass
public Class<?> getEnumClass()
PUBLIC: Get the class which was set as the enum class which contains the fromValue method.
-
-