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 booleandisableConversion()INTERNAL: Return true if any auto apply converter should be disabled.booleanequals(java.lang.Object objectToCompare)INTERNAL:java.lang.StringgetAttributeName()INTERNAL: Used for OX mapping.MetadataClassgetConverterClass()INTERNAL:java.lang.StringgetConverterClassName()INTERNAL: Used for OX mapping.java.lang.BooleangetDisableConversion()INTERNAL: Used for OX mapping.protected java.lang.StringgetText()INTERNAL: Used for OX mapping.booleanhasAttributeName()INTERNAL:booleanhasConverterClass()INTERNAL:inthashCode()voidinitXMLObject(MetadataAccessibleObject accessibleObject, XMLEntityMappings entityMappings)INTERNAL:booleanisForMapKey()INTERNAL: Return true if this convert metadata is for a map key.voidprocess(org.eclipse.persistence.mappings.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.voidprocess(org.eclipse.persistence.mappings.DatabaseMapping mapping, MetadataClass referenceClass, ClassAccessor accessor, java.lang.String embeddedAttributeName)INTERNAL: Apply convert for@ElementCollectionmapping where we expect@Convertannotation to containattributeName="value.<name>".voidsetAttributeName(java.lang.String attributeName)INTERNAL: Used for OX mapping.voidsetConverterClassName(java.lang.String converterClassName)INTERNAL: Used for OX mapping.voidsetDisableConversion(java.lang.Boolean disableConversion)INTERNAL: Used for OX mapping.voidsetText(java.lang.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(java.lang.Object objectToCompare)
INTERNAL:- Specified by:
equalsin classORMetadata
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
getAttributeName
public java.lang.String getAttributeName()
INTERNAL: Used for OX mapping.
-
getConverterClass
public MetadataClass getConverterClass()
INTERNAL:
-
getConverterClassName
public java.lang.String getConverterClassName()
INTERNAL: Used for OX mapping.
-
getDisableConversion
public java.lang.Boolean getDisableConversion()
INTERNAL: Used for OX mapping.
-
getText
protected java.lang.String getText()
INTERNAL: Used for OX mapping. Any ORMetadata that supported mixed types, that is, text or other metadata should override this method.- Overrides:
getTextin classORMetadata
-
hasAttributeName
public boolean hasAttributeName()
INTERNAL:
-
hasConverterClass
public boolean hasConverterClass()
INTERNAL:
-
initXMLObject
public void initXMLObject(MetadataAccessibleObject accessibleObject, XMLEntityMappings entityMappings)
INTERNAL:- Overrides:
initXMLObjectin 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(org.eclipse.persistence.mappings.DatabaseMapping mapping, MetadataClass referenceClass, ClassAccessor accessor, java.lang.String embeddedAttributeName)INTERNAL: Apply convert for@ElementCollectionmapping where we expect@Convertannotation 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(org.eclipse.persistence.mappings.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(java.lang.String attributeName)
INTERNAL: Used for OX mapping.
-
setConverterClassName
public void setConverterClassName(java.lang.String converterClassName)
INTERNAL: Used for OX mapping.
-
setDisableConversion
public void setDisableConversion(java.lang.Boolean disableConversion)
INTERNAL: Used for OX mapping.
-
setText
public void setText(java.lang.String text)
INTERNAL: Used for OX mapping.
-
-