Class CFMetaDataParser

  • All Implemented Interfaces:
    MetaDataParser, org.xml.sax.ContentHandler, org.xml.sax.DTDHandler, org.xml.sax.EntityResolver, org.xml.sax.ErrorHandler, org.xml.sax.ext.LexicalHandler
    Direct Known Subclasses:
    XMLPersistenceMetaDataParser

    public class CFMetaDataParser
    extends XMLMetaDataParser
    Custom SAX parser used by the system to quickly parse metadata files for classes.
    Author:
    Abe White
    • Constructor Detail

      • CFMetaDataParser

        public CFMetaDataParser()
    • Method Detail

      • isPackageElementName

        protected boolean isPackageElementName​(java.lang.String name)
        The name of the package element. Defaults to "package".
      • getPackageAttributeName

        protected java.lang.String getPackageAttributeName()
        The attribute of the package element that holds the name, or null to use the element text. Defaults to "name".
      • getPackageElementDepth

        protected int getPackageElementDepth()
        The depth of the package element. Defaults to 1.
      • isClassElementName

        protected boolean isClassElementName​(java.lang.String name)
        The name of the class element. Defaults to "class".
      • getClassAttributeName

        protected java.lang.String getClassAttributeName()
        The attribute of the class element that holds the name, or null to use the element text. Defaults to "name".
      • getClassElementDepth

        protected int getClassElementDepth()
        The depth of the class element. Defaults to 2.
      • startElement

        protected boolean startElement​(java.lang.String name,
                                       org.xml.sax.Attributes attrs)
                                throws org.xml.sax.SAXException
        Description copied from class: XMLMetaDataParser
        Override this method marking the start of some element. If this method returns false, the content of the element and the end element event will be ignored.
        Specified by:
        startElement in class XMLMetaDataParser
        Throws:
        org.xml.sax.SAXException
      • endElement

        protected void endElement​(java.lang.String name)
                           throws org.xml.sax.SAXException
        Description copied from class: XMLMetaDataParser
        Override this method marking the end of some element.
        Specified by:
        endElement in class XMLMetaDataParser
        Throws:
        org.xml.sax.SAXException
      • startPackage

        protected boolean startPackage​(java.lang.String elem,
                                       org.xml.sax.Attributes attrs)
                                throws org.xml.sax.SAXException
        Start a package. Parses out package attribute by default. Return false to skip package element and its contents.
        Throws:
        org.xml.sax.SAXException
      • endPackage

        protected void endPackage​(java.lang.String elem)
        End a package. Parses contained text by default.
      • startClass

        protected boolean startClass​(java.lang.String elem,
                                     org.xml.sax.Attributes attrs)
                              throws org.xml.sax.SAXException
        Start a class. Parses out class name by default. Return false to skip class element and its contents.
        Throws:
        org.xml.sax.SAXException
      • endClass

        protected void endClass​(java.lang.String elem)
                         throws org.xml.sax.SAXException
        End a class. Parses contained text by default.
        Throws:
        org.xml.sax.SAXException
      • startExtendedClass

        protected boolean startExtendedClass​(java.lang.String elem,
                                             org.xml.sax.Attributes attrs)
                                      throws org.xml.sax.SAXException
        Throws:
        org.xml.sax.SAXException
      • endExtendedClass

        protected void endExtendedClass​(java.lang.String elem)
                                 throws org.xml.sax.SAXException
        Throws:
        org.xml.sax.SAXException
      • startSystemElement

        protected boolean startSystemElement​(java.lang.String name,
                                             org.xml.sax.Attributes attrs)
                                      throws org.xml.sax.SAXException
        Override this method marking the start of an element outside of any package or class.
        Throws:
        org.xml.sax.SAXException
      • endSystemElement

        protected void endSystemElement​(java.lang.String name)
                                 throws org.xml.sax.SAXException
        Override this method marking the end of an element outside of any package or class.
        Throws:
        org.xml.sax.SAXException
      • startPackageElement

        protected boolean startPackageElement​(java.lang.String name,
                                              org.xml.sax.Attributes attrs)
                                       throws org.xml.sax.SAXException
        Override this method marking the start of an element within a declared package.
        Throws:
        org.xml.sax.SAXException
      • endPackageElement

        protected void endPackageElement​(java.lang.String name)
                                  throws org.xml.sax.SAXException
        Override this method marking the end of an element within a declared package.
        Throws:
        org.xml.sax.SAXException
      • startClassElement

        protected boolean startClassElement​(java.lang.String name,
                                            org.xml.sax.Attributes attrs)
                                     throws org.xml.sax.SAXException
        Override this method marking the start of an element within a declared class.
        Throws:
        org.xml.sax.SAXException
      • endClassElement

        protected void endClassElement​(java.lang.String name)
                                throws org.xml.sax.SAXException
        Override this method marking the end of an element within a declared class.
        Throws:
        org.xml.sax.SAXException
      • reset

        protected void reset()
        Override this method to clear any state and ready the parser for a new document. Subclasses should call super.reset() to clear superclass state.
        Overrides:
        reset in class XMLMetaDataParser
      • currentClassName

        protected java.lang.String currentClassName()
        Return the current class being parsed; the returned name will be fully qualified.
      • currentPackage

        protected java.lang.String currentPackage()
        Return the current package being parsed.
      • classForName

        protected java.lang.Class<?> classForName​(java.lang.String name,
                                                  boolean resolve)
                                           throws org.xml.sax.SAXException
        Helper method to create the Class for the given name, taking into account the package currently being parsed for relative class names.
        Throws:
        org.xml.sax.SAXException
      • classForName

        public static java.lang.Class<?> classForName​(java.lang.String name,
                                                      java.lang.String pkg,
                                                      boolean resolve,
                                                      java.lang.ClassLoader loader)
        Load the given class name against the given package and the set of accepted standard packages. Return null if the class cannot be loaded.