Class AnnotationPersistenceMappingSerializer
java.lang.Object
org.apache.openjpa.persistence.AnnotationPersistenceMetaDataSerializer
org.apache.openjpa.persistence.jdbc.AnnotationPersistenceMappingSerializer
- All Implemented Interfaces:
MetaDataSerializer
,AbstractCFMetaDataFactory.Serializer
Serializes persistence mappings as annotations.
- Since:
- 1.0.0
- Author:
- Steve Kim, Gokhan Ergul
-
Nested Class Summary
Modifier and TypeClassDescriptionprotected class
ExtendsAnnotationPersistenceMetaDataSerializer.SerializationComparator
for store-specific tags such as <sql-result-set-mapping>.Nested classes/interfaces inherited from class org.apache.openjpa.persistence.AnnotationPersistenceMetaDataSerializer
AnnotationPersistenceMetaDataSerializer.SerializationComparator
-
Field Summary
Fields inherited from class org.apache.openjpa.persistence.AnnotationPersistenceMetaDataSerializer
TYPE_CLASS_QUERIES, TYPE_CLASS_SEQS, TYPE_META, TYPE_QUERY, TYPE_SEQ
Fields inherited from interface org.apache.openjpa.lib.meta.MetaDataSerializer
APPEND, COMPACT, PRETTY, VERBOSE
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addAll
(MetaDataRepository repos) Add all components in the given repository to the set to be serialized.protected AnnotationBuilder
addAnnotation
(Class<? extends Annotation> annType, QueryResultMapping meta) Creates an an annotation builder for the specified class metadata and adds it to list of builders.protected void
addAnnotation
(AnnotationBuilder ab, QueryResultMapping meta) Add an annotation builder to list of builders for the specified class metadata.void
Adds the given result set mapping to local cache.protected void
addSystemMappingElements
(Collection toSerialize) Add system-level mapping elements to be serialized.void
clear()
Clear the set of metadatas to be serialized.protected jakarta.persistence.EnumType
getEnumType
(FieldMapping field) Return enum type for the field.protected PersistenceStrategy
getStrategy
(FieldMetaData fmd) Return the serialized strategy name.boolean
Whether to automatically synchronize mapping info with data available from mapped components before serialization.Create a new comparator for ordering objects that are to be serialized.boolean
removeAll
(MetaDataRepository repos) Remove all the components in the given repository from the set to be serialized.boolean
Removes given result set mapping from the local cache.protected boolean
serializeAttributeOverride
(FieldMetaData fmd, FieldMetaData orig) Always returns false by default.protected void
serializeAttributeOverrideMappingContent
(FieldMetaData fmd, FieldMetaData orig, AnnotationBuilder ab) Serialize attribute override mapping content.protected void
serializeClass
(ClassMetaData meta) Serialize class metadata.protected void
Serialize class mapping content.protected void
serializeFieldMappingContent
(FieldMetaData fmd, PersistenceStrategy strategy, AnnotationBuilder ab) Serialize field mapping content; this will be called before#serializeValueMappingContent
.protected void
serializeInheritanceContent
(ClassMetaData mapping) Serialize inheritance content.protected void
Serialize query mappings.protected void
Serialize sequence metadata.protected void
Serialize unknown mapping element at system level.void
setSyncMappingInfo
(boolean sync) Whether to automatically synchronize mapping info with data available from mapped components before serialization.protected int
Return the type constant for the given object based on its runtime class.Methods inherited from class org.apache.openjpa.persistence.AnnotationPersistenceMetaDataSerializer
addAnnotation, addAnnotation, addAnnotation, addAnnotation, addAnnotation, addAnnotation, addAnnotation, addAnnotation, addAnnotation, addClassMappingAnnotations, addFieldMappingAttributes, addMetaData, addQueryMetaData, addSequenceMetaData, addStrategyMappingAttributes, getClassMetaData, getConfiguration, getLog, getMode, getObjects, isMappingMode, isMappingMode, isMappingMode, isMetaDataMode, isQueryMode, newAnnotationBuilder, removeMetaData, removeQueryMetaData, removeSequenceMetaData, serialize, serialize, serialize, serialize, serialize, setLog, setMode, setMode, writeAnnotations
-
Constructor Details
-
AnnotationPersistenceMappingSerializer
Constructor. Supply configuration.
-
-
Method Details
-
getSyncMappingInfo
public boolean getSyncMappingInfo()Whether to automatically synchronize mapping info with data available from mapped components before serialization. Defaults to false. -
setSyncMappingInfo
public void setSyncMappingInfo(boolean sync) Whether to automatically synchronize mapping info with data available from mapped components before serialization. Defaults to false. -
addQueryResultMapping
Adds the given result set mapping to local cache. -
removeQueryResultMapping
Removes given result set mapping from the local cache. -
addAll
Description copied from class:AnnotationPersistenceMetaDataSerializer
Add all components in the given repository to the set to be serialized.- Specified by:
addAll
in interfaceAbstractCFMetaDataFactory.Serializer
- Overrides:
addAll
in classAnnotationPersistenceMetaDataSerializer
-
removeAll
Description copied from class:AnnotationPersistenceMetaDataSerializer
Remove all the components in the given repository from the set to be serialized.- Overrides:
removeAll
in classAnnotationPersistenceMetaDataSerializer
- Returns:
- true if any components removed, false if none in set
-
clear
public void clear()Description copied from class:AnnotationPersistenceMetaDataSerializer
Clear the set of metadatas to be serialized.- Overrides:
clear
in classAnnotationPersistenceMetaDataSerializer
-
addAnnotation
Add an annotation builder to list of builders for the specified class metadata. -
addAnnotation
protected AnnotationBuilder addAnnotation(Class<? extends Annotation> annType, QueryResultMapping meta) Creates an an annotation builder for the specified class metadata and adds it to list of builders. -
serializeClass
Description copied from class:AnnotationPersistenceMetaDataSerializer
Serialize class metadata.- Overrides:
serializeClass
in classAnnotationPersistenceMetaDataSerializer
-
serializeClassMappingContent
Description copied from class:AnnotationPersistenceMetaDataSerializer
Serialize class mapping content. Does nothing by default.- Overrides:
serializeClassMappingContent
in classAnnotationPersistenceMetaDataSerializer
-
serializeInheritanceContent
Description copied from class:AnnotationPersistenceMetaDataSerializer
Serialize inheritance content. Does nothing by default.- Overrides:
serializeInheritanceContent
in classAnnotationPersistenceMetaDataSerializer
-
serializeAttributeOverride
Description copied from class:AnnotationPersistenceMetaDataSerializer
Always returns false by default.- Overrides:
serializeAttributeOverride
in classAnnotationPersistenceMetaDataSerializer
-
serializeAttributeOverrideMappingContent
protected void serializeAttributeOverrideMappingContent(FieldMetaData fmd, FieldMetaData orig, AnnotationBuilder ab) Description copied from class:AnnotationPersistenceMetaDataSerializer
Serialize attribute override mapping content. Does nothing by default,- Overrides:
serializeAttributeOverrideMappingContent
in classAnnotationPersistenceMetaDataSerializer
-
getStrategy
Description copied from class:AnnotationPersistenceMetaDataSerializer
Return the serialized strategy name.- Overrides:
getStrategy
in classAnnotationPersistenceMetaDataSerializer
-
serializeFieldMappingContent
protected void serializeFieldMappingContent(FieldMetaData fmd, PersistenceStrategy strategy, AnnotationBuilder ab) Description copied from class:AnnotationPersistenceMetaDataSerializer
Serialize field mapping content; this will be called before#serializeValueMappingContent
. Does nothing by default.- Overrides:
serializeFieldMappingContent
in classAnnotationPersistenceMetaDataSerializer
-
getEnumType
Return enum type for the field. -
newSerializationComparator
protected AnnotationPersistenceMetaDataSerializer.SerializationComparator newSerializationComparator()Description copied from class:AnnotationPersistenceMetaDataSerializer
Create a new comparator for ordering objects that are to be serialized.- Overrides:
newSerializationComparator
in classAnnotationPersistenceMetaDataSerializer
-
addSystemMappingElements
Description copied from class:AnnotationPersistenceMetaDataSerializer
Add system-level mapping elements to be serialized. Does nothing by default.- Overrides:
addSystemMappingElements
in classAnnotationPersistenceMetaDataSerializer
-
type
Description copied from class:AnnotationPersistenceMetaDataSerializer
Return the type constant for the given object based on its runtime class. If the runtime class does not correspond to any of the known types then returns -1. This can happen for tags that are not handled at this store-agnostic level.- Overrides:
type
in classAnnotationPersistenceMetaDataSerializer
-
serializeSystemMappingElement
Description copied from class:AnnotationPersistenceMetaDataSerializer
Serialize unknown mapping element at system level.- Overrides:
serializeSystemMappingElement
in classAnnotationPersistenceMetaDataSerializer
-
serializeQueryMappings
Description copied from class:AnnotationPersistenceMetaDataSerializer
Serialize query mappings. Does nothing by default.- Overrides:
serializeQueryMappings
in classAnnotationPersistenceMetaDataSerializer
-
serializeSequence
Description copied from class:AnnotationPersistenceMetaDataSerializer
Serialize sequence metadata.- Overrides:
serializeSequence
in classAnnotationPersistenceMetaDataSerializer
-