Module org.eclipse.persistence.jpa
Class ConvertMetadata
java.lang.Object
org.eclipse.persistence.internal.jpa.metadata.ORMetadata
org.eclipse.persistence.internal.jpa.metadata.converters.ConvertMetadata
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
-
Field Summary
Fields inherited from class org.eclipse.persistence.internal.jpa.metadata.ORMetadata
m_project -
Constructor Summary
ConstructorsConstructorDescriptionINTERNAL: Used for XML loading.ConvertMetadata(MetadataAnnotation convert, MetadataAccessor accessor) INTERNAL: Used for annotation loading. -
Method Summary
Modifier and TypeMethodDescriptionbooleanINTERNAL: Return true if any auto apply converter should be disabled.booleanINTERNAL:INTERNAL: Used for OX mapping.INTERNAL:INTERNAL: Used for OX mapping.INTERNAL: Used for OX mapping.protected StringgetText()INTERNAL: Used for OX mapping.booleanINTERNAL:booleanINTERNAL:inthashCode()voidinitXMLObject(MetadataAccessibleObject accessibleObject, XMLEntityMappings entityMappings) INTERNAL:booleanINTERNAL: Return true if this convert metadata is for a map key.voidprocess(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(DatabaseMapping mapping, MetadataClass referenceClass, ClassAccessor accessor, String embeddedAttributeName) INTERNAL: Apply convert for@ElementCollectionmapping where we expect@Convertannotation to containattributeName="value.<name>".voidsetAttributeName(String attributeName) INTERNAL: Used for OX mapping.voidsetConverterClassName(String converterClassName) INTERNAL: Used for OX mapping.voidsetDisableConversion(Boolean disableConversion) INTERNAL: Used for OX mapping.voidINTERNAL: 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 Details
-
ConvertMetadata
public ConvertMetadata()INTERNAL: Used for XML loading. -
ConvertMetadata
INTERNAL: Used for annotation loading.
-
-
Method Details
-
disableConversion
public boolean disableConversion()INTERNAL: Return true if any auto apply converter should be disabled. -
equals
INTERNAL:- Specified by:
equalsin classORMetadata
-
hashCode
public int hashCode() -
getAttributeName
INTERNAL: Used for OX mapping. -
getConverterClass
INTERNAL: -
getConverterClassName
INTERNAL: Used for OX mapping. -
getDisableConversion
INTERNAL: Used for OX mapping. -
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(DatabaseMapping mapping, MetadataClass referenceClass, ClassAccessor accessor, 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(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
INTERNAL: Used for OX mapping. -
setConverterClassName
INTERNAL: Used for OX mapping. -
setDisableConversion
INTERNAL: Used for OX mapping. -
setText
INTERNAL: Used for OX mapping.
-