Module org.eclipse.persistence.moxy
Class XMLJavaTypeConverter
- java.lang.Object
-
- org.eclipse.persistence.oxm.mappings.converters.XMLConverterAdapter
-
- org.eclipse.persistence.internal.jaxb.XMLJavaTypeConverter
-
- All Implemented Interfaces:
Serializable,CoreConverter<DatabaseMapping,Session>,Converter,XMLConverter
public class XMLJavaTypeConverter extends XMLConverterAdapter
Converter that wraps an XmlAdapter.- See Also:
XmlAdapter, Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected Class<?>boundTypeprotected DatabaseMappingmappingprotected CoreConverter<DatabaseMapping,Session>nestedConverterprotected QNameschemaTypeprotected Class<?>valueTypeprotected jakarta.xml.bind.annotation.adapters.XmlAdapter<?,?>xmlAdapterprotected Class<? extends jakarta.xml.bind.annotation.adapters.XmlAdapter<?,?>>xmlAdapterClassprotected StringxmlAdapterClassName
-
Constructor Summary
Constructors Constructor Description XMLJavaTypeConverter()The default constructor.XMLJavaTypeConverter(Class<?> xmlAdapterClass)This constructor takes the XmlAdapter class to be used with this converter.XMLJavaTypeConverter(Class<?> xmlAdapterClass, QName schemaType)This constructor takes the XmlAdapter class to be used with this converter, as well as a schema type to be used during the conversion operation.XMLJavaTypeConverter(String xmlAdapterClassName)This constructor takes an adapter class name.XMLJavaTypeConverter(String xmlAdapterClassName, QName schemaType)This constructor takes the XmlAdapter class name to be used with this converter (loaded during initialization), as well as a schema type to be used during the conversion operation.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ObjectconvertDataValueToObjectValue(Object dataValue, Session session, XMLUnmarshaller unmarshaller)Wraps the XmlAdapter unmarshal method.ObjectconvertObjectValueToDataValue(Object objectValue, Session session, XMLMarshaller marshaller)Wraps the XmlAdapter marshal method.CoreConverter<DatabaseMapping,Session>getNestedConverter()Get the nested converter to that is used in conjunction with the adapter.QNamegetSchemaType()Get the schema type to be used during conversion.Class<? extends jakarta.xml.bind.annotation.adapters.XmlAdapter<?,?>>getXmlAdapterClass()Return the XmlAdapter class for this converter.StringgetXmlAdapterClassName()Return the XmlAdapter class name for this converter.voidinitialize(DatabaseMapping mapping, Session session)Figure out the BoundType and ValueType for the XmlAdapter class, then either create an instance of the XmlAdapter, or if an instance is set on the marshaller, use it.booleanisMutable()Satisfy the interface.voidsetNestedConverter(CoreConverter<DatabaseMapping,Session> nestedConverter)Set a nested converter to be used in conjunction with the adapter.voidsetSchemaType(QName qname)Set the schema type to be used during conversion - if one is required.voidsetXmlAdapterClass(Class<? extends jakarta.xml.bind.annotation.adapters.XmlAdapter<?,?>> xmlAdapterClass)Set the XmlAdapter class to be used with this converter.voidsetXmlAdapterClassName(String xmlAdapterClassName)Set the XmlAdapter class to be used with this converter.-
Methods inherited from class org.eclipse.persistence.oxm.mappings.converters.XMLConverterAdapter
convertDataValueToObjectValue, convertObjectValueToDataValue
-
-
-
-
Field Detail
-
boundType
protected Class<?> boundType
-
valueType
protected Class<?> valueType
-
xmlAdapterClass
protected Class<? extends jakarta.xml.bind.annotation.adapters.XmlAdapter<?,?>> xmlAdapterClass
-
xmlAdapterClassName
protected String xmlAdapterClassName
-
xmlAdapter
protected jakarta.xml.bind.annotation.adapters.XmlAdapter<?,?> xmlAdapter
-
schemaType
protected QName schemaType
-
mapping
protected DatabaseMapping mapping
-
nestedConverter
protected CoreConverter<DatabaseMapping,Session> nestedConverter
-
-
Constructor Detail
-
XMLJavaTypeConverter
public XMLJavaTypeConverter()
The default constructor. This constructor should be used in conjunction with the setXmlAdapterClass method or setXmlAdapterClassName method.
-
XMLJavaTypeConverter
public XMLJavaTypeConverter(Class<?> xmlAdapterClass)
This constructor takes the XmlAdapter class to be used with this converter.
-
XMLJavaTypeConverter
public XMLJavaTypeConverter(String xmlAdapterClassName)
This constructor takes an adapter class name. The adapter class will be loaded during initialization.
-
XMLJavaTypeConverter
public XMLJavaTypeConverter(Class<?> xmlAdapterClass, QName schemaType)
This constructor takes the XmlAdapter class to be used with this converter, as well as a schema type to be used during the conversion operation. During unmarshal, the value type will be converted to the schema type, then from that type to the bound type. The opposite will occur during marshal.
-
XMLJavaTypeConverter
public XMLJavaTypeConverter(String xmlAdapterClassName, QName schemaType)
This constructor takes the XmlAdapter class name to be used with this converter (loaded during initialization), as well as a schema type to be used during the conversion operation. During unmarshal, the value type will be converted to the schema type, then from that type to the bound type. The opposite will occur during marshal.
-
-
Method Detail
-
convertDataValueToObjectValue
public Object convertDataValueToObjectValue(Object dataValue, Session session, XMLUnmarshaller unmarshaller)
Wraps the XmlAdapter unmarshal method.
-
convertObjectValueToDataValue
public Object convertObjectValueToDataValue(Object objectValue, Session session, XMLMarshaller marshaller)
Wraps the XmlAdapter marshal method.
-
getSchemaType
public QName getSchemaType()
Get the schema type to be used during conversion.
-
getXmlAdapterClass
public Class<? extends jakarta.xml.bind.annotation.adapters.XmlAdapter<?,?>> getXmlAdapterClass()
Return the XmlAdapter class for this converter.- Returns:
- xmlAdapterClass
-
getXmlAdapterClassName
public String getXmlAdapterClassName()
Return the XmlAdapter class name for this converter. If null, the name will be set to "".- Returns:
- xmlAdapterClassName
-
initialize
public void initialize(DatabaseMapping mapping, Session session)
Figure out the BoundType and ValueType for the XmlAdapter class, then either create an instance of the XmlAdapter, or if an instance is set on the marshaller, use it.
-
isMutable
public boolean isMutable()
Satisfy the interface.
-
setSchemaType
public void setSchemaType(QName qname)
Set the schema type to be used during conversion - if one is required.
-
setXmlAdapterClass
public void setXmlAdapterClass(Class<? extends jakarta.xml.bind.annotation.adapters.XmlAdapter<?,?>> xmlAdapterClass)
Set the XmlAdapter class to be used with this converter.
-
setXmlAdapterClassName
public void setXmlAdapterClassName(String xmlAdapterClassName)
Set the XmlAdapter class to be used with this converter.
-
getNestedConverter
public CoreConverter<DatabaseMapping,Session> getNestedConverter()
Get the nested converter to that is used in conjunction with the adapter.
-
setNestedConverter
public void setNestedConverter(CoreConverter<DatabaseMapping,Session> nestedConverter)
Set a nested converter to be used in conjunction with the adapter. On marshal, the nested converter is invoked after the adapter. On umarshal it is invoked before. Primarily used to support enumerations with adapters.
-
-