Class PomHandler

  • All Implemented Interfaces:
    org.xml.sax.ContentHandler, org.xml.sax.DTDHandler, org.xml.sax.EntityResolver, org.xml.sax.ErrorHandler

    @NotThreadSafe
    public class PomHandler
    extends org.xml.sax.helpers.DefaultHandler
    A handler to read the pom.xml model.
    Author:
    Jeremy Long
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static java.lang.String ARTIFACTID
      The artifactId element.
      static java.lang.String DESCRIPTION
      The description element.
      static java.lang.String DEVELOPER_EMAIL
      The developer email element.
      static java.lang.String DEVELOPER_ID
      The developer id element.
      static java.lang.String DEVELOPER_NODE
      The developer element.
      static java.lang.String DEVELOPER_ORGANIZATION
      The developer organization element.
      static java.lang.String DEVELOPER_ORGANIZATION_URL
      The developer organization URL element.
      static java.lang.String DEVELOPERS
      The developers element.
      static java.lang.String GROUPID
      The artifactId element.
      static java.lang.String LICENSE_NODE
      The license element.
      static java.lang.String LICENSES
      The licenses element.
      static java.lang.String NAME
      The name element.
      static java.lang.String ORGANIZATION
      The organization element.
      static java.lang.String PARENT
      The parent element.
      static java.lang.String PROJECT
      The project element.
      static java.lang.String URL
      The URL element.
      static java.lang.String VERSION
      The version element.
    • Constructor Summary

      Constructors 
      Constructor Description
      PomHandler()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void characters​(char[] ch, int start, int length)
      Collects the body text of the node being processed.
      void endElement​(java.lang.String uri, java.lang.String localName, java.lang.String qName)
      Handles the end element event.
      Model getModel()
      Returns the model obtained from the pom.xml.
      void startElement​(java.lang.String uri, java.lang.String localName, java.lang.String qName, org.xml.sax.Attributes attributes)
      Handles the start element event.
      • Methods inherited from class org.xml.sax.helpers.DefaultHandler

        endDocument, endPrefixMapping, error, fatalError, ignorableWhitespace, notationDecl, processingInstruction, resolveEntity, setDocumentLocator, skippedEntity, startDocument, startPrefixMapping, unparsedEntityDecl, warning
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • PROJECT

        public static final java.lang.String PROJECT
        The project element.
        See Also:
        Constant Field Values
      • GROUPID

        public static final java.lang.String GROUPID
        The artifactId element.
        See Also:
        Constant Field Values
      • ARTIFACTID

        public static final java.lang.String ARTIFACTID
        The artifactId element.
        See Also:
        Constant Field Values
      • VERSION

        public static final java.lang.String VERSION
        The version element.
        See Also:
        Constant Field Values
      • PARENT

        public static final java.lang.String PARENT
        The parent element.
        See Also:
        Constant Field Values
      • ORGANIZATION

        public static final java.lang.String ORGANIZATION
        The organization element.
        See Also:
        Constant Field Values
      • DESCRIPTION

        public static final java.lang.String DESCRIPTION
        The description element.
        See Also:
        Constant Field Values
      • LICENSES

        public static final java.lang.String LICENSES
        The licenses element.
        See Also:
        Constant Field Values
      • LICENSE_NODE

        public static final java.lang.String LICENSE_NODE
        The license element.
        See Also:
        Constant Field Values
      • DEVELOPERS

        public static final java.lang.String DEVELOPERS
        The developers element.
        See Also:
        Constant Field Values
      • DEVELOPER_NODE

        public static final java.lang.String DEVELOPER_NODE
        The developer element.
        See Also:
        Constant Field Values
      • DEVELOPER_ID

        public static final java.lang.String DEVELOPER_ID
        The developer id element.
        See Also:
        Constant Field Values
      • DEVELOPER_EMAIL

        public static final java.lang.String DEVELOPER_EMAIL
        The developer email element.
        See Also:
        Constant Field Values
      • DEVELOPER_ORGANIZATION

        public static final java.lang.String DEVELOPER_ORGANIZATION
        The developer organization element.
        See Also:
        Constant Field Values
      • DEVELOPER_ORGANIZATION_URL

        public static final java.lang.String DEVELOPER_ORGANIZATION_URL
        The developer organization URL element.
        See Also:
        Constant Field Values
    • Constructor Detail

      • PomHandler

        public PomHandler()
    • Method Detail

      • getModel

        public Model getModel()
        Returns the model obtained from the pom.xml.
        Returns:
        the model object
      • startElement

        public void startElement​(java.lang.String uri,
                                 java.lang.String localName,
                                 java.lang.String qName,
                                 org.xml.sax.Attributes attributes)
                          throws org.xml.sax.SAXException
        Handles the start element event.
        Specified by:
        startElement in interface org.xml.sax.ContentHandler
        Overrides:
        startElement in class org.xml.sax.helpers.DefaultHandler
        Parameters:
        uri - the uri of the element being processed
        localName - the local name of the element being processed
        qName - the qName of the element being processed
        attributes - the attributes of the element being processed
        Throws:
        org.xml.sax.SAXException - thrown if there is an exception processing
      • endElement

        public void endElement​(java.lang.String uri,
                               java.lang.String localName,
                               java.lang.String qName)
                        throws org.xml.sax.SAXException
        Handles the end element event.
        Specified by:
        endElement in interface org.xml.sax.ContentHandler
        Overrides:
        endElement in class org.xml.sax.helpers.DefaultHandler
        Parameters:
        uri - the URI of the element
        localName - the local name of the element
        qName - the qName of the element
        Throws:
        org.xml.sax.SAXException - thrown if there is an exception processing
      • characters

        public void characters​(char[] ch,
                               int start,
                               int length)
                        throws org.xml.sax.SAXException
        Collects the body text of the node being processed.
        Specified by:
        characters in interface org.xml.sax.ContentHandler
        Overrides:
        characters in class org.xml.sax.helpers.DefaultHandler
        Parameters:
        ch - the char array of text
        start - the start position to copy text from in the char array
        length - the number of characters to copy from the char array
        Throws:
        org.xml.sax.SAXException - thrown if there is a parsing exception