Class AbstractMetaDataHandler

    • Field Detail

      • filename

        protected final String filename
        Filename containing the XML metadata
      • metadata

        protected MetaData metadata
        The MetaData for this file (the end result of the parse process).
      • entityResolver

        protected final EntityResolver entityResolver
        Entity Resolver to use (if required)
      • charactersBuffer

        protected StringBuilder charactersBuffer
        parser buffer
      • validate

        protected boolean validate
        Whether to validate while parsing.
      • stack

        protected Stack<MetaData> stack
        Stack of meta-data elements. The top of the stack is always the element being process at the moment. The elements are not the XML Element type but are things like ClassMetaData, PackageMetaData etc.
    • Constructor Detail

      • AbstractMetaDataHandler

        public AbstractMetaDataHandler​(MetaDataManager mmgr,
                                       String filename,
                                       EntityResolver resolver)
        Constructor.
        Parameters:
        mmgr - Manager for the MetaData
        filename - The filename
        resolver - Entity Resolver to use (null if not available)
    • Method Detail

      • isPersistenceContext

        public boolean isPersistenceContext()
      • setValidate

        public void setValidate​(boolean validate)
        Method to set whether to validate during the the handling.
        Parameters:
        validate - Whether to validate
      • getMetaData

        public MetaData getMetaData()
        Accessor for the MetaData for this file.
        Returns:
        The MetaData.
      • getAttr

        protected String getAttr​(Attributes attrs,
                                 String key,
                                 String defaultValue)
        Accessor for an attribute out of the attributes for an element. Allows the specification of a default if no value is provided.
        Parameters:
        attrs - The attributes
        key - Key for the attribute to return
        defaultValue - A default to impose if no value.
        Returns:
        Value for the attribute with the specified key.
      • getAttr

        protected String getAttr​(Attributes attrs,
                                 String key)
        Accessor for an attribute out of the attributes for an element.
        Parameters:
        attrs - The attributes
        key - Key for the attribute to return
        Returns:
        Value for the attribute with the specified key.
      • characters

        public void characters​(char[] ch,
                               int start,
                               int length)
                        throws SAXException
        Notification handler for the "body" data inside an element.
        Specified by:
        characters in interface ContentHandler
        Overrides:
        characters in class DefaultHandler
        Parameters:
        ch - The characters
        start - The start position in the character array.
        length - The length of the string.
        Throws:
        SAXException - in parsing errors
      • getString

        public String getString()
        Accessor for the "body" text metadata. Resets the body text after access.
        Returns:
        the string form of this metadata
      • getStack

        protected MetaData getStack()
        Accessor for the current MetaData component.
        Returns:
        The current MetaData component.
      • popStack

        protected MetaData popStack()
        Method to remove the current MetaData component from the Stack.
        Returns:
        Latest MetaData component.
      • pushStack

        protected void pushStack​(MetaData md)
        Method to add a MetaData component to the Stack.
        Parameters:
        md - The component to add.