public class AnnotationPersistenceMetaDataSerializer extends Object implements AbstractCFMetaDataFactory.Serializer
Modifier and Type | Class and Description |
---|---|
protected class |
AnnotationPersistenceMetaDataSerializer.SerializationComparator
Compares clases, sequences, and queries to order them for serialization.
|
Modifier and Type | Field and Description |
---|---|
protected static int |
TYPE_CLASS_QUERIES |
protected static int |
TYPE_CLASS_SEQS |
protected static int |
TYPE_META |
protected static int |
TYPE_QUERY |
protected static int |
TYPE_SEQ |
APPEND, COMPACT, PRETTY, VERBOSE
Constructor and Description |
---|
AnnotationPersistenceMetaDataSerializer(OpenJPAConfiguration conf)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
addAll(MetaDataRepository repos)
Add all components in the given repository to the set to be serialized.
|
protected void |
addAnnotation(AnnotationBuilder ab,
ClassMetaData meta)
Add an annotation builder to list of builders for the specified
class metadata.
|
protected void |
addAnnotation(AnnotationBuilder ab,
FieldMetaData meta)
Add an annotation builder to list of builders for the specified
field metadata.
|
protected void |
addAnnotation(AnnotationBuilder ab,
Object meta) |
protected void |
addAnnotation(AnnotationBuilder ab,
QueryMetaData meta)
Add an annotation builder to list of builders for the specified
query metadata.
|
protected void |
addAnnotation(AnnotationBuilder ab,
SequenceMetaData meta)
Add an annotation builder to list of builders for the specified
sequence metadata.
|
protected AnnotationBuilder |
addAnnotation(Class<? extends Annotation> annType,
ClassMetaData meta)
Creates an an annotation builder for the specified class metadata
and adds it to list of builders.
|
protected AnnotationBuilder |
addAnnotation(Class<? extends Annotation> annType,
FieldMetaData meta)
Creates an an annotation builder for the specified class metadata
and adds it to list of builders.
|
protected AnnotationBuilder |
addAnnotation(Class<? extends Annotation> annType,
QueryMetaData meta)
Creates an an annotation builder for the specified class metadata
and adds it to list of builders.
|
protected AnnotationBuilder |
addAnnotation(Class<? extends Annotation> annType,
SequenceMetaData meta)
Creates an an annotation builder for the specified class metadata
and adds it to list of builders.
|
protected void |
addClassMappingAnnotations(ClassMetaData mapping)
Add mapping attributes for the given class.
|
protected void |
addFieldMappingAttributes(FieldMetaData fmd,
FieldMetaData orig,
AnnotationBuilder ab)
Add mapping attributes for the given field.
|
void |
addMetaData(ClassMetaData meta)
Add a class meta data to the set to be serialized.
|
void |
addQueryMetaData(QueryMetaData meta)
Add a query meta data to the set to be serialized.
|
void |
addSequenceMetaData(SequenceMetaData meta)
Add a sequence meta data to the set to be serialized.
|
protected void |
addStrategyMappingAttributes(FieldMetaData fmd,
AnnotationBuilder ab)
Set mapping attributes for strategy.
|
protected void |
addSystemMappingElements(Collection toSerialize)
Add system-level mapping elements to be serialized.
|
void |
clear()
Clear the set of metadatas to be serialized.
|
Map<String,ClassMetaData> |
getClassMetaData()
Returns the stored ClassMetaData
|
OpenJPAConfiguration |
getConfiguration()
Configuration.
|
Log |
getLog()
The log to write to.
|
int |
getMode()
The serialization mode according to the expected document type.
|
protected Collection |
getObjects() |
protected PersistenceStrategy |
getStrategy(FieldMetaData fmd)
Return the serialized strategy name.
|
protected boolean |
isMappingMode()
Convenience method for interpreting
getMode() . |
protected boolean |
isMappingMode(ClassMetaData meta)
Convenience method for interpreting
getMode() . |
protected boolean |
isMappingMode(ValueMetaData vmd)
Convenience method for interpreting
getMode() . |
protected boolean |
isMetaDataMode()
Convenience method for interpreting
getMode() . |
protected boolean |
isQueryMode()
Convenience method for interpreting
getMode() . |
protected AnnotationBuilder |
newAnnotationBuilder(Class<? extends Annotation> annType)
Creates a new annotation builder for the specified annotation type.
|
protected AnnotationPersistenceMetaDataSerializer.SerializationComparator |
newSerializationComparator()
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 |
removeMetaData(ClassMetaData meta)
Remove a metadata from the set to be serialized.
|
boolean |
removeQueryMetaData(QueryMetaData meta)
Remove a query metadata from the set to be serialized.
|
boolean |
removeSequenceMetaData(SequenceMetaData meta)
Remove a sequence metadata from the set to be serialized.
|
protected void |
serialize(Collection objects) |
void |
serialize(File file,
int flags)
Serialize the current set of objects to the given file.
|
void |
serialize(int flags)
Serialize the current set of objects to the files from which they were
parsed.
|
void |
serialize(Map output,
int flags)
Serialize the current set of objects to the files from which they were
parsed.
|
void |
serialize(Writer out,
int flags)
Serialize the current set of objects to the given stream.
|
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 |
serializeClassMappingContent(ClassMetaData mapping)
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 |
serializeQueryMappings(ClassMetaData meta)
Serialize query mappings.
|
protected void |
serializeSequence(SequenceMetaData meta)
Serialize sequence metadata.
|
protected void |
serializeSystemMappingElement(Object obj)
Serialize unknown mapping element at system level.
|
void |
setLog(Log log)
The log to write to.
|
void |
setMode(int mode)
The serialization mode according to the expected document type.
|
void |
setMode(int mode,
boolean on)
The serialization mode according to the expected document type.
|
protected int |
type(Object o)
Return the type constant for the given object based on its runtime
class.
|
protected void |
writeAnnotations(Object meta,
List<AnnotationBuilder> builders,
Map output) |
protected static final int TYPE_SEQ
protected static final int TYPE_QUERY
protected static final int TYPE_META
protected static final int TYPE_CLASS_SEQS
protected static final int TYPE_CLASS_QUERIES
public AnnotationPersistenceMetaDataSerializer(OpenJPAConfiguration conf)
public OpenJPAConfiguration getConfiguration()
public Log getLog()
public void setLog(Log log)
public int getMode()
public void setMode(int mode)
setMode
in interface AbstractCFMetaDataFactory.Serializer
public void setMode(int mode, boolean on)
protected boolean isMetaDataMode()
getMode()
.protected boolean isQueryMode()
getMode()
.protected boolean isMappingMode()
getMode()
.protected boolean isMappingMode(ClassMetaData meta)
getMode()
. Takes into
account whether mapping information is loaded for the given instance.
OPENJPA-1360 - Allow @Column attributes when meta.isEmbeddedOnly()protected boolean isMappingMode(ValueMetaData vmd)
getMode()
. Takes into
account whether mapping information is loaded for the given instance.public void addMetaData(ClassMetaData meta)
addMetaData
in interface AbstractCFMetaDataFactory.Serializer
public void addSequenceMetaData(SequenceMetaData meta)
addSequenceMetaData
in interface AbstractCFMetaDataFactory.Serializer
public void addQueryMetaData(QueryMetaData meta)
addQueryMetaData
in interface AbstractCFMetaDataFactory.Serializer
public void addAll(MetaDataRepository repos)
addAll
in interface AbstractCFMetaDataFactory.Serializer
public boolean removeMetaData(ClassMetaData meta)
removeMetaData
in interface AbstractCFMetaDataFactory.Serializer
public boolean removeSequenceMetaData(SequenceMetaData meta)
public boolean removeQueryMetaData(QueryMetaData meta)
public boolean removeAll(MetaDataRepository repos)
public void clear()
protected void addSystemMappingElements(Collection toSerialize)
protected AnnotationPersistenceMetaDataSerializer.SerializationComparator newSerializationComparator()
protected AnnotationBuilder newAnnotationBuilder(Class<? extends Annotation> annType)
protected void addAnnotation(AnnotationBuilder ab, Object meta)
protected void addAnnotation(AnnotationBuilder ab, ClassMetaData meta)
protected void addAnnotation(AnnotationBuilder ab, FieldMetaData meta)
protected void addAnnotation(AnnotationBuilder ab, SequenceMetaData meta)
protected void addAnnotation(AnnotationBuilder ab, QueryMetaData meta)
protected AnnotationBuilder addAnnotation(Class<? extends Annotation> annType, ClassMetaData meta)
protected AnnotationBuilder addAnnotation(Class<? extends Annotation> annType, FieldMetaData meta)
protected AnnotationBuilder addAnnotation(Class<? extends Annotation> annType, SequenceMetaData meta)
protected AnnotationBuilder addAnnotation(Class<? extends Annotation> annType, QueryMetaData meta)
protected void serialize(Collection objects)
protected int type(Object o)
protected void serializeSystemMappingElement(Object obj)
protected void serializeSequence(SequenceMetaData meta)
protected void serializeClass(ClassMetaData meta)
protected void addClassMappingAnnotations(ClassMetaData mapping)
protected void serializeClassMappingContent(ClassMetaData mapping)
protected void serializeInheritanceContent(ClassMetaData mapping)
protected void serializeQueryMappings(ClassMetaData meta)
protected void addFieldMappingAttributes(FieldMetaData fmd, FieldMetaData orig, AnnotationBuilder ab)
protected boolean serializeAttributeOverride(FieldMetaData fmd, FieldMetaData orig)
protected void serializeAttributeOverrideMappingContent(FieldMetaData fmd, FieldMetaData orig, AnnotationBuilder ab)
protected PersistenceStrategy getStrategy(FieldMetaData fmd)
protected void serializeFieldMappingContent(FieldMetaData fmd, PersistenceStrategy strategy, AnnotationBuilder ab)
#serializeValueMappingContent
. Does nothing by default.protected void addStrategyMappingAttributes(FieldMetaData fmd, AnnotationBuilder ab)
protected Collection getObjects()
protected void writeAnnotations(Object meta, List<AnnotationBuilder> builders, Map output)
public void serialize(Map output, int flags) throws IOException
MetaDataSerializer
SourceTracker
interface.serialize
in interface MetaDataSerializer
output
- if null, then serialize directly to the file system;
otherwise, populate the specified Map
with
keys that are the File
instances, and
values that are the String
contents of the MetaDataflags
- bit flags specifying the output flags; e.g. MetaDataSerializer.PRETTY
IOException
public void serialize(File file, int flags) throws IOException
MetaDataSerializer
serialize
in interface MetaDataSerializer
flags
- bit flags specifying the output flags; e.g.
MetaDataSerializer.PRETTY
| MetaDataSerializer.APPEND
IOException
public void serialize(Writer out, int flags) throws IOException
MetaDataSerializer
serialize
in interface MetaDataSerializer
flags
- bit flags specifying the output flags; e.g. MetaDataSerializer.PRETTY
IOException
public void serialize(int flags) throws IOException
MetaDataSerializer
serialize
in interface MetaDataSerializer
flags
- bit flags specifying the output flags; e.g. MetaDataSerializer.PRETTY
IOException
public Map<String,ClassMetaData> getClassMetaData()
Copyright © 2006–2019 Apache Software Foundation. All rights reserved.