Class ConvertMetadata
- java.lang.Object
-
- org.eclipse.persistence.internal.jpa.metadata.ORMetadata
-
- org.eclipse.persistence.internal.jpa.metadata.converters.ConvertMetadata
-
public class ConvertMetadata extends ORMetadata
Object to hold onto convert metadata. Key notes: - any metadata mapped from XML to this class must be compared in the equals method. - any metadata mapped from XML to this class must be initialized in the initXMLObject method. - when loading from annotations, the constructor accepts the metadata accessor this metadata was loaded from. Used it to look up any 'companion' annotation needed for processing. - methods should be preserved in alphabetical order.- Since:
- EclipseLink 2.5
- Author:
- Guy Pelletier
-
-
Field Summary
-
Fields inherited from class org.eclipse.persistence.internal.jpa.metadata.ORMetadata
m_project
-
-
Constructor Summary
Constructors Constructor Description ConvertMetadata()
INTERNAL: Used for XML loading.ConvertMetadata(MetadataAnnotation convert, MetadataAccessor accessor)
INTERNAL: Used for annotation loading.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
disableConversion()
INTERNAL: Return true if any auto apply converter should be disabled.boolean
equals(Object objectToCompare)
INTERNAL:String
getAttributeName()
INTERNAL: Used for OX mapping.MetadataClass
getConverterClass()
INTERNAL:String
getConverterClassName()
INTERNAL: Used for OX mapping.Boolean
getDisableConversion()
INTERNAL: Used for OX mapping.protected String
getText()
INTERNAL: Used for OX mapping.boolean
hasAttributeName()
INTERNAL:boolean
hasConverterClass()
INTERNAL:int
hashCode()
void
initXMLObject(MetadataAccessibleObject accessibleObject, XMLEntityMappings entityMappings)
INTERNAL:boolean
isForMapKey()
INTERNAL: Return true if this convert metadata is for a map key.void
process(DatabaseMapping mapping, MetadataClass referenceClass, ClassAccessor accessor, boolean isForMapKey)
INTERNAL: By the time we get here, we have the mapping that needs to have the convert applied to.void
process(DatabaseMapping mapping, MetadataClass referenceClass, ClassAccessor accessor, String embeddedAttributeName)
INTERNAL: Apply convert for@ElementCollection
mapping where we expect@Convert
annotation to containattributeName="value.<name>"
.void
setAttributeName(String attributeName)
INTERNAL: Used for OX mapping.void
setConverterClassName(String converterClassName)
INTERNAL: Used for OX mapping.void
setDisableConversion(Boolean disableConversion)
INTERNAL: Used for OX mapping.void
setText(String text)
INTERNAL: Used for OX mapping.-
Methods inherited from class org.eclipse.persistence.internal.jpa.metadata.ORMetadata
getAccessibleObject, getAccessibleObjectName, getAnnotation, getBoxedType, getDatabaseTypeEnum, getEntityMappings, getFullyQualifiedClassName, getIdentifier, getJavaClass, getJavaClassName, getLoader, getLocation, getLogger, getMetadataClass, getMetadataClass, getMetadataClass, getMetadataFactory, getName, getPrimitiveClassForName, getProject, getXMLElement, hasIdentifier, hasText, initXMLClassName, initXMLObject, initXMLObjects, initXMLTextObject, loadedFromAnnotation, loadedFromEclipseLinkXML, loadedFromXML, merge, mergeORObjectLists, mergeORObjects, mergeSimpleObjects, reloadEntity, reloadMappedSuperclass, setAccessibleObject, setEntityMappings, setFieldName, setFieldName, setProject, shouldOverride, valuesMatch, valuesMatch
-
-
-
-
Constructor Detail
-
ConvertMetadata
public ConvertMetadata()
INTERNAL: Used for XML loading.
-
ConvertMetadata
public ConvertMetadata(MetadataAnnotation convert, MetadataAccessor accessor)
INTERNAL: Used for annotation loading.
-
-
Method Detail
-
disableConversion
public boolean disableConversion()
INTERNAL: Return true if any auto apply converter should be disabled.
-
equals
public boolean equals(Object objectToCompare)
INTERNAL:- Specified by:
equals
in classORMetadata
-
getAttributeName
public String getAttributeName()
INTERNAL: Used for OX mapping.
-
getConverterClass
public MetadataClass getConverterClass()
INTERNAL:
-
getConverterClassName
public String getConverterClassName()
INTERNAL: Used for OX mapping.
-
getDisableConversion
public Boolean getDisableConversion()
INTERNAL: Used for OX mapping.
-
getText
protected String getText()
INTERNAL: Used for OX mapping. Any ORMetadata that supported mixed types, that is, text or other metadata should override this method.- Overrides:
getText
in classORMetadata
-
hasAttributeName
public boolean hasAttributeName()
INTERNAL:
-
hasConverterClass
public boolean hasConverterClass()
INTERNAL:
-
initXMLObject
public void initXMLObject(MetadataAccessibleObject accessibleObject, XMLEntityMappings entityMappings)
INTERNAL:- Overrides:
initXMLObject
in classORMetadata
-
isForMapKey
public boolean isForMapKey()
INTERNAL: Return true if this convert metadata is for a map key. Way to tell is if there is an attribute name that begins with "key". Calling this method will also update the attribute name on the first call to it. This call is made when sorting convert annotations. Unlike XML, where the user can sort through <convert> and <map-key-convert> elements, there is only a single Convert annotation that uses a "key" prefix on the attribute name to signify a map key convert. An unforunate decision by the JPA spec committee, but we can make it work of course.
-
process
public void process(DatabaseMapping mapping, MetadataClass referenceClass, ClassAccessor accessor, String embeddedAttributeName)
INTERNAL: Apply convert for@ElementCollection
mapping where we expect@Convert
annotation to containattributeName="value.<name>"
.- Parameters:
mapping
- Database attribute mapping.referenceClass
- JPA annotated class.accessor
- Class accessor.embeddedAttributeName
- Content of<name>
fromattributeName="value.<name>"
.
-
process
public void process(DatabaseMapping mapping, MetadataClass referenceClass, ClassAccessor accessor, boolean isForMapKey)
INTERNAL: By the time we get here, we have the mapping that needs to have the convert applied to. Do some validation checks along with some embedded mapping traversing if need be and apply the converter. Will look an auto-apply converter as well if one is not specified directly.- Parameters:
mapping
- Database attribute mapping.referenceClass
- JPA annotated class.accessor
- Class accessor.isForMapKey
- Is this converter for MapKey?
-
setAttributeName
public void setAttributeName(String attributeName)
INTERNAL: Used for OX mapping.
-
setConverterClassName
public void setConverterClassName(String converterClassName)
INTERNAL: Used for OX mapping.
-
setDisableConversion
public void setDisableConversion(Boolean disableConversion)
INTERNAL: Used for OX mapping.
-
setText
public void setText(String text)
INTERNAL: Used for OX mapping.
-
-