Class XMLPersistenceMetaDataSerializer

    • Constructor Detail

      • XMLPersistenceMetaDataSerializer

        public XMLPersistenceMetaDataSerializer​(OpenJPAConfiguration conf)
        Constructor. Supply configuration.
    • Method Detail

      • getSerializeAnnotations

        public boolean getSerializeAnnotations()
        Whether to serialize content originally specified in annotations. Defaults to true.
      • setSerializeAnnotations

        public void setSerializeAnnotations​(boolean annos)
        Whether to serialize content originally specified in annotations. Defaults to true.
      • getMode

        public int getMode()
        The serialization mode according to the expected document type. The mode constants act as bit flags, and therefore can be combined.
      • setMode

        public void setMode​(int mode)
        The serialization mode according to the expected document type. The mode constants act as bit flags, and therefore can be combined.
        Specified by:
        setMode in interface AbstractCFMetaDataFactory.Serializer
      • setMode

        public void setMode​(int mode,
                            boolean on)
        The serialization mode according to the expected document type.
      • getSourceFile

        protected java.io.File getSourceFile​(java.lang.Object obj)
        Override to not overwrite annotations.
        Overrides:
        getSourceFile in class XMLMetaDataSerializer
      • isMetaDataMode

        protected boolean isMetaDataMode()
        Convenience method for interpreting getMode().
      • isQueryMode

        protected boolean isQueryMode()
        Convenience method for interpreting getMode().
      • isMappingMode

        protected boolean isMappingMode()
        Convenience method for interpreting getMode().
      • isMappingMode

        protected boolean isMappingMode​(ClassMetaData meta)
        Convenience method for interpreting getMode(). Takes into account whether mapping information is loaded for the given instance.
      • isMappingMode

        protected boolean isMappingMode​(ValueMetaData vmd)
        Convenience method for interpreting getMode(). Takes into account whether mapping information is loaded for the given instance.
      • removeSequenceMetaData

        public boolean removeSequenceMetaData​(SequenceMetaData meta)
        Remove a sequence metadata from the set to be serialized.
        Returns:
        true if removed, false if not in set
      • removeQueryMetaData

        public boolean removeQueryMetaData​(QueryMetaData meta)
        Remove a query metadata from the set to be serialized.
        Returns:
        true if removed, false if not in set
      • removeAll

        public boolean removeAll​(MetaDataRepository repos)
        Remove all the components in the given repository from the set to be serialized.
        Returns:
        true if any components removed, false if none in set
      • clear

        public void clear()
        Clear the set of metadatas to be serialized.
      • addSystemMappingElements

        protected void addSystemMappingElements​(java.util.Collection toSerialize)
        Add system-level mapping elements to be serialized. Does nothing by default.
      • serialize

        protected void serialize​(java.util.Collection objects)
                          throws org.xml.sax.SAXException
        Description copied from class: XMLMetaDataSerializer
        Serialize the given set of objects.
        Specified by:
        serialize in class XMLMetaDataSerializer
        Throws:
        org.xml.sax.SAXException
      • type

        protected int type​(java.lang.Object o)
        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.
      • serializeSystemMappingElement

        protected void serializeSystemMappingElement​(java.lang.Object obj)
                                              throws org.xml.sax.SAXException
        Serialize unknown mapping element at system level.
        Throws:
        org.xml.sax.SAXException
      • serializeSequence

        protected void serializeSequence​(SequenceMetaData meta)
                                  throws org.xml.sax.SAXException
        Serialize sequence metadata.
        Throws:
        org.xml.sax.SAXException
      • serializeClass

        protected void serializeClass​(ClassMetaData meta,
                                      boolean access)
                               throws org.xml.sax.SAXException
        Serialize class metadata.
        Throws:
        org.xml.sax.SAXException
      • addClassMappingAttributes

        protected void addClassMappingAttributes​(ClassMetaData mapping)
                                          throws org.xml.sax.SAXException
        Add mapping attributes for the given class. Does nothing by default
        Throws:
        org.xml.sax.SAXException
      • serializeClassMappingContent

        protected void serializeClassMappingContent​(ClassMetaData mapping)
                                             throws org.xml.sax.SAXException
        Serialize class mapping content. Does nothing by default.
        Throws:
        org.xml.sax.SAXException
      • serializeInheritanceContent

        protected void serializeInheritanceContent​(ClassMetaData mapping)
                                            throws org.xml.sax.SAXException
        Serialize inheritance content. Does nothing by default.
        Throws:
        org.xml.sax.SAXException
      • serializeQueryMappings

        protected void serializeQueryMappings​(ClassMetaData meta)
                                       throws org.xml.sax.SAXException
        Serialize query mappings. Does nothing by default.
        Throws:
        org.xml.sax.SAXException
      • addFieldMappingAttributes

        protected void addFieldMappingAttributes​(FieldMetaData fmd,
                                                 FieldMetaData orig)
                                          throws org.xml.sax.SAXException
        Add mapping attributes for the given field. Does nothing by default.
        Throws:
        org.xml.sax.SAXException
      • serializeAttributeOverride

        protected boolean serializeAttributeOverride​(FieldMetaData fmd,
                                                     FieldMetaData orig)
        Always returns false by default.
      • serializeAttributeOverrideMappingContent

        protected void serializeAttributeOverrideMappingContent​(FieldMetaData fmd,
                                                                FieldMetaData orig)
                                                         throws org.xml.sax.SAXException
        Serialize attribute override mapping content. Does nothing by default,
        Throws:
        org.xml.sax.SAXException
      • serializeFieldMappingContent

        protected void serializeFieldMappingContent​(FieldMetaData fmd,
                                                    PersistenceStrategy strategy)
                                             throws org.xml.sax.SAXException
        Serialize field mapping content; this will be called before #serializeValueMappingContent. Does nothing by default.
        Throws:
        org.xml.sax.SAXException
      • addStrategyMappingAttributes

        protected void addStrategyMappingAttributes​(FieldMetaData fmd)
                                             throws org.xml.sax.SAXException
        Set mapping attributes for strategy. Sets mapped-by by default.
        Throws:
        org.xml.sax.SAXException
      • serializeOrderColumn

        protected void serializeOrderColumn​(FieldMetaData fmd)
                                     throws org.xml.sax.SAXException
        Order column is not processed as meta data, instead it can be processed as mapping data if in mapping mode.
        Throws:
        org.xml.sax.SAXException
      • getClassMetaData

        public java.util.Map<java.lang.String,​ClassMetaData> getClassMetaData()
        Returns the stored ClassMetaData