Class AnnotationPersistenceMappingSerializer
- java.lang.Object
- 
- org.apache.openjpa.persistence.AnnotationPersistenceMetaDataSerializer
- 
- org.apache.openjpa.persistence.jdbc.AnnotationPersistenceMappingSerializer
 
 
- 
- All Implemented Interfaces:
- MetaDataSerializer,- AbstractCFMetaDataFactory.Serializer
 
 public class AnnotationPersistenceMappingSerializer extends AnnotationPersistenceMetaDataSerializer Serializes persistence mappings as annotations.- Since:
- 1.0.0
- Author:
- Steve Kim, Gokhan Ergul
 
- 
- 
Nested Class SummaryNested Classes Modifier and Type Class Description protected classAnnotationPersistenceMappingSerializer.MappingSerializationComparatorExtendsAnnotationPersistenceMetaDataSerializer.SerializationComparatorfor store-specific tags such as <sql-result-set-mapping>.- 
Nested classes/interfaces inherited from class org.apache.openjpa.persistence.AnnotationPersistenceMetaDataSerializerAnnotationPersistenceMetaDataSerializer.SerializationComparator
 
- 
 - 
Field Summary- 
Fields inherited from class org.apache.openjpa.persistence.AnnotationPersistenceMetaDataSerializerTYPE_CLASS_QUERIES, TYPE_CLASS_SEQS, TYPE_META, TYPE_QUERY, TYPE_SEQ
 - 
Fields inherited from interface org.apache.openjpa.lib.meta.MetaDataSerializerAPPEND, COMPACT, PRETTY, VERBOSE
 
- 
 - 
Constructor SummaryConstructors Constructor Description AnnotationPersistenceMappingSerializer(JDBCConfiguration conf)Constructor.
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddAll(MetaDataRepository repos)Add all components in the given repository to the set to be serialized.protected AnnotationBuilderaddAnnotation(java.lang.Class<? extends java.lang.annotation.Annotation> annType, QueryResultMapping meta)Creates an an annotation builder for the specified class metadata and adds it to list of builders.protected voidaddAnnotation(AnnotationBuilder ab, QueryResultMapping meta)Add an annotation builder to list of builders for the specified class metadata.voidaddQueryResultMapping(QueryResultMapping meta)Adds the given result set mapping to local cache.protected voidaddSystemMappingElements(java.util.Collection toSerialize)Add system-level mapping elements to be serialized.voidclear()Clear the set of metadatas to be serialized.protected jakarta.persistence.EnumTypegetEnumType(FieldMapping field)Return enum type for the field.protected PersistenceStrategygetStrategy(FieldMetaData fmd)Return the serialized strategy name.booleangetSyncMappingInfo()Whether to automatically synchronize mapping info with data available from mapped components before serialization.protected AnnotationPersistenceMetaDataSerializer.SerializationComparatornewSerializationComparator()Create a new comparator for ordering objects that are to be serialized.booleanremoveAll(MetaDataRepository repos)Remove all the components in the given repository from the set to be serialized.booleanremoveQueryResultMapping(QueryResultMapping meta)Removes given result set mapping from the local cache.protected booleanserializeAttributeOverride(FieldMetaData fmd, FieldMetaData orig)Always returns false by default.protected voidserializeAttributeOverrideMappingContent(FieldMetaData fmd, FieldMetaData orig, AnnotationBuilder ab)Serialize attribute override mapping content.protected voidserializeClass(ClassMetaData meta)Serialize class metadata.protected voidserializeClassMappingContent(ClassMetaData mapping)Serialize class mapping content.protected voidserializeFieldMappingContent(FieldMetaData fmd, PersistenceStrategy strategy, AnnotationBuilder ab)Serialize field mapping content; this will be called before#serializeValueMappingContent.protected voidserializeInheritanceContent(ClassMetaData mapping)Serialize inheritance content.protected voidserializeQueryMappings(ClassMetaData meta)Serialize query mappings.protected voidserializeSequence(SequenceMetaData meta)Serialize sequence metadata.protected voidserializeSystemMappingElement(java.lang.Object obj)Serialize unknown mapping element at system level.voidsetSyncMappingInfo(boolean sync)Whether to automatically synchronize mapping info with data available from mapped components before serialization.protected inttype(java.lang.Object o)Return the type constant for the given object based on its runtime class.- 
Methods inherited from class org.apache.openjpa.persistence.AnnotationPersistenceMetaDataSerializeraddAnnotation, 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 Detail- 
AnnotationPersistenceMappingSerializerpublic AnnotationPersistenceMappingSerializer(JDBCConfiguration conf) Constructor. Supply configuration.
 
- 
 - 
Method Detail- 
getSyncMappingInfopublic boolean getSyncMappingInfo() Whether to automatically synchronize mapping info with data available from mapped components before serialization. Defaults to false.
 - 
setSyncMappingInfopublic void setSyncMappingInfo(boolean sync) Whether to automatically synchronize mapping info with data available from mapped components before serialization. Defaults to false.
 - 
addQueryResultMappingpublic void addQueryResultMapping(QueryResultMapping meta) Adds the given result set mapping to local cache.
 - 
removeQueryResultMappingpublic boolean removeQueryResultMapping(QueryResultMapping meta) Removes given result set mapping from the local cache.
 - 
addAllpublic void addAll(MetaDataRepository repos) Description copied from class:AnnotationPersistenceMetaDataSerializerAdd all components in the given repository to the set to be serialized.- Specified by:
- addAllin interface- AbstractCFMetaDataFactory.Serializer
- Overrides:
- addAllin class- AnnotationPersistenceMetaDataSerializer
 
 - 
removeAllpublic boolean removeAll(MetaDataRepository repos) Description copied from class:AnnotationPersistenceMetaDataSerializerRemove all the components in the given repository from the set to be serialized.- Overrides:
- removeAllin class- AnnotationPersistenceMetaDataSerializer
- Returns:
- true if any components removed, false if none in set
 
 - 
clearpublic void clear() Description copied from class:AnnotationPersistenceMetaDataSerializerClear the set of metadatas to be serialized.- Overrides:
- clearin class- AnnotationPersistenceMetaDataSerializer
 
 - 
addAnnotationprotected void addAnnotation(AnnotationBuilder ab, QueryResultMapping meta) Add an annotation builder to list of builders for the specified class metadata.
 - 
addAnnotationprotected AnnotationBuilder addAnnotation(java.lang.Class<? extends java.lang.annotation.Annotation> annType, QueryResultMapping meta) Creates an an annotation builder for the specified class metadata and adds it to list of builders.
 - 
serializeClassprotected void serializeClass(ClassMetaData meta) Description copied from class:AnnotationPersistenceMetaDataSerializerSerialize class metadata.- Overrides:
- serializeClassin class- AnnotationPersistenceMetaDataSerializer
 
 - 
serializeClassMappingContentprotected void serializeClassMappingContent(ClassMetaData mapping) Description copied from class:AnnotationPersistenceMetaDataSerializerSerialize class mapping content. Does nothing by default.- Overrides:
- serializeClassMappingContentin class- AnnotationPersistenceMetaDataSerializer
 
 - 
serializeInheritanceContentprotected void serializeInheritanceContent(ClassMetaData mapping) Description copied from class:AnnotationPersistenceMetaDataSerializerSerialize inheritance content. Does nothing by default.- Overrides:
- serializeInheritanceContentin class- AnnotationPersistenceMetaDataSerializer
 
 - 
serializeAttributeOverrideprotected boolean serializeAttributeOverride(FieldMetaData fmd, FieldMetaData orig) Description copied from class:AnnotationPersistenceMetaDataSerializerAlways returns false by default.- Overrides:
- serializeAttributeOverridein class- AnnotationPersistenceMetaDataSerializer
 
 - 
serializeAttributeOverrideMappingContentprotected void serializeAttributeOverrideMappingContent(FieldMetaData fmd, FieldMetaData orig, AnnotationBuilder ab) Description copied from class:AnnotationPersistenceMetaDataSerializerSerialize attribute override mapping content. Does nothing by default,- Overrides:
- serializeAttributeOverrideMappingContentin class- AnnotationPersistenceMetaDataSerializer
 
 - 
getStrategyprotected PersistenceStrategy getStrategy(FieldMetaData fmd) Description copied from class:AnnotationPersistenceMetaDataSerializerReturn the serialized strategy name.- Overrides:
- getStrategyin class- AnnotationPersistenceMetaDataSerializer
 
 - 
serializeFieldMappingContentprotected void serializeFieldMappingContent(FieldMetaData fmd, PersistenceStrategy strategy, AnnotationBuilder ab) Description copied from class:AnnotationPersistenceMetaDataSerializerSerialize field mapping content; this will be called before#serializeValueMappingContent. Does nothing by default.- Overrides:
- serializeFieldMappingContentin class- AnnotationPersistenceMetaDataSerializer
 
 - 
getEnumTypeprotected jakarta.persistence.EnumType getEnumType(FieldMapping field) Return enum type for the field.
 - 
newSerializationComparatorprotected AnnotationPersistenceMetaDataSerializer.SerializationComparator newSerializationComparator() Description copied from class:AnnotationPersistenceMetaDataSerializerCreate a new comparator for ordering objects that are to be serialized.- Overrides:
- newSerializationComparatorin class- AnnotationPersistenceMetaDataSerializer
 
 - 
addSystemMappingElementsprotected void addSystemMappingElements(java.util.Collection toSerialize) Description copied from class:AnnotationPersistenceMetaDataSerializerAdd system-level mapping elements to be serialized. Does nothing by default.- Overrides:
- addSystemMappingElementsin class- AnnotationPersistenceMetaDataSerializer
 
 - 
typeprotected int type(java.lang.Object o) Description copied from class:AnnotationPersistenceMetaDataSerializerReturn 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:
- typein class- AnnotationPersistenceMetaDataSerializer
 
 - 
serializeSystemMappingElementprotected void serializeSystemMappingElement(java.lang.Object obj) Description copied from class:AnnotationPersistenceMetaDataSerializerSerialize unknown mapping element at system level.- Overrides:
- serializeSystemMappingElementin class- AnnotationPersistenceMetaDataSerializer
 
 - 
serializeQueryMappingsprotected void serializeQueryMappings(ClassMetaData meta) Description copied from class:AnnotationPersistenceMetaDataSerializerSerialize query mappings. Does nothing by default.- Overrides:
- serializeQueryMappingsin class- AnnotationPersistenceMetaDataSerializer
 
 - 
serializeSequenceprotected void serializeSequence(SequenceMetaData meta) Description copied from class:AnnotationPersistenceMetaDataSerializerSerialize sequence metadata.- Overrides:
- serializeSequencein class- AnnotationPersistenceMetaDataSerializer
 
 
- 
 
-