Interface ConfigurationXMLStreamReader

All Superinterfaces:
AutoCloseable, XMLStreamConstants, XMLStreamReader

public interface ConfigurationXMLStreamReader extends XMLStreamReader, AutoCloseable
Author:
David M. Lloyd
  • Field Details

    • EMPTY_CHARS

      static final char[] EMPTY_CHARS
  • Method Details

    • getUri

      URI getUri()
    • getXmlInputFactory

      XMLInputFactory getXmlInputFactory()
    • getIncludedFrom

      XMLLocation getIncludedFrom()
    • hasNext

      boolean hasNext() throws ConfigXMLParseException
      Specified by:
      hasNext in interface XMLStreamReader
      Throws:
      ConfigXMLParseException
    • next

      int next() throws ConfigXMLParseException
      Specified by:
      next in interface XMLStreamReader
      Throws:
      ConfigXMLParseException
    • hasNamespace

      default boolean hasNamespace()
      Determine whether the current element has a non-empty namespace URI.
      Returns:
      true if the element has a non-empty namespace URI, false otherwise
    • namespaceURIEquals

      default boolean namespaceURIEquals(String uri)
      Determine whether the current element has a namespace URI equal to the given value. If the given value is null or empty, this method returns true only if the current element has no namespace.
      Parameters:
      uri - the namespace URI to test
      Returns:
      true if the element has a namespace URI equal to the argument, or the argument is null or empty and the element has no namespace, or false otherwise
    • hasAttributeNamespace

      default boolean hasAttributeNamespace(int idx)
      Determine whether the current element has an attribute at the given index with a non-empty namespace URI.
      Parameters:
      idx - the attribute index
      Returns:
      true if the attribute has a non-empty namespace URI, false otherwise
    • attributeNamespaceEquals

      default boolean attributeNamespaceEquals(int idx, String uri)
      Determine whether the current element has an attribute at the given index with a namespace URI equal to the given value. If the given value is null or empty, this method returns true only if the attribute has no namespace.
      Parameters:
      idx - the attribute index
      uri - the namespace URI to test
      Returns:
      true if the attribute has a namespace URI equal to the argument, or the argument is null or empty and the element has no namespace, or false otherwise
    • nextTag

      default int nextTag() throws ConfigXMLParseException
      Specified by:
      nextTag in interface XMLStreamReader
      Throws:
      ConfigXMLParseException
    • getElementText

      default String getElementText() throws ConfigXMLParseException
      Specified by:
      getElementText in interface XMLStreamReader
      Throws:
      ConfigXMLParseException
    • getElementExpression

      default Expression getElementExpression(Expression.Flag... flags) throws ConfigXMLParseException
      Get the element text content as an expression.
      Parameters:
      flags - the expression compilation flags
      Returns:
      the expression (not null)
      Throws:
      ConfigXMLParseException - if the value is not a valid expression by the given flags
    • require

      default void require(int type, String namespaceURI, String localName) throws ConfigXMLParseException
      Specified by:
      require in interface XMLStreamReader
      Throws:
      ConfigXMLParseException
    • isStartElement

      default boolean isStartElement()
      Specified by:
      isStartElement in interface XMLStreamReader
    • isEndElement

      default boolean isEndElement()
      Specified by:
      isEndElement in interface XMLStreamReader
    • isCharacters

      default boolean isCharacters()
      Specified by:
      isCharacters in interface XMLStreamReader
    • isWhiteSpace

      default boolean isWhiteSpace()
      Specified by:
      isWhiteSpace in interface XMLStreamReader
    • eventToString

      static String eventToString(int type)
    • getProperty

      default Object getProperty(String name) throws IllegalArgumentException
      Specified by:
      getProperty in interface XMLStreamReader
      Throws:
      IllegalArgumentException
    • hasText

      default boolean hasText()
      Specified by:
      hasText in interface XMLStreamReader
    • isStandalone

      default boolean isStandalone()
      Specified by:
      isStandalone in interface XMLStreamReader
    • standaloneSet

      default boolean standaloneSet()
      Specified by:
      standaloneSet in interface XMLStreamReader
    • hasName

      default boolean hasName()
      Specified by:
      hasName in interface XMLStreamReader
    • getLocation

      XMLLocation getLocation()
      Specified by:
      getLocation in interface XMLStreamReader
    • getTextCharacters

      int getTextCharacters(int sourceStart, char[] target, int targetStart, int length) throws ConfigXMLParseException
      Specified by:
      getTextCharacters in interface XMLStreamReader
      Throws:
      ConfigXMLParseException
    • close

      void close() throws ConfigXMLParseException
      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface XMLStreamReader
      Throws:
      ConfigXMLParseException
    • skipContent

      default void skipContent() throws ConfigXMLParseException
      Throws:
      ConfigXMLParseException
    • unexpectedElement

      default ConfigXMLParseException unexpectedElement()
      Return a throwable exception explaining that the element at the current position was not expected.
      Returns:
      the exception
    • unexpectedAttribute

      default ConfigXMLParseException unexpectedAttribute(int i)
      Return a throwable exception explaining that the attribute at the current position with the given index was not expected.
      Parameters:
      i - the attribute index
      Returns:
      the exception
    • unexpectedDocumentEnd

      default ConfigXMLParseException unexpectedDocumentEnd()
      Return a throwable exception explaining that the document end was reached unexpectedly.
      Returns:
      the exception
    • unexpectedContent

      default ConfigXMLParseException unexpectedContent()
      Return a throwable exception explaining that some unexpected content was encountered.
      Returns:
      the exception
    • missingRequiredElement

      default ConfigXMLParseException missingRequiredElement(String namespaceUri, String localName)
      Return a throwable exception explaining that a required element with the given namespace and local name was missing.
      Parameters:
      namespaceUri - the namespace URI
      localName - the local element name
      Returns:
      the exception
    • missingRequiredAttribute

      default ConfigXMLParseException missingRequiredAttribute(String namespaceUri, String localName)
      Return a throwable exception explaining that a required attribute with the given namespace and local name was missing.
      Parameters:
      namespaceUri - the namespace URI (or null if it is a local name)
      localName - the local attribute name
      Returns:
      the exception
    • numericAttributeValueOutOfRange

      default ConfigXMLParseException numericAttributeValueOutOfRange(int index, long minValue, long maxValue)
      Return a throwable exception explaining that a numeric attribute at the given index was out of its required range.
      Parameters:
      index - the attribute index
      minValue - the minimum attribute value
      maxValue - the maximum attribute value
      Returns:
      the exception
    • getAttributeValue

      String getAttributeValue(int index)
      Get the value of an attribute.
      Specified by:
      getAttributeValue in interface XMLStreamReader
      Parameters:
      index - the index of the attribute
      Returns:
      the attribute value
    • getAttributeValueResolved

      default String getAttributeValueResolved(int index) throws ConfigXMLParseException
      Get the value of an attribute with expressions resolved.
      Parameters:
      index - the index of the attribute
      Returns:
      the attribute value
      Throws:
      ConfigXMLParseException - if an error occurs
    • getIntAttributeValue

      default int getIntAttributeValue(int index) throws ConfigXMLParseException
      Get the value of an attribute as an integer.
      Parameters:
      index - the index of the attribute
      Returns:
      the integer value
      Throws:
      ConfigXMLParseException - if an error occurs
    • getIntAttributeValueResolved

      default int getIntAttributeValueResolved(int index) throws ConfigXMLParseException
      Get the value of an attribute as an integer with expressions resolved.
      Parameters:
      index - the index of the attribute
      Returns:
      the integer value
      Throws:
      ConfigXMLParseException - if an error occurs
    • getIntAttributeValue

      default int getIntAttributeValue(int index, int minValue, int maxValue) throws ConfigXMLParseException
      Get the value of an attribute as an integer.
      Parameters:
      index - the index of the attribute
      minValue - the minimum allowed value
      maxValue - the maximum allowed value
      Returns:
      the integer value
      Throws:
      ConfigXMLParseException - if an error occurs
    • getIntAttributeValueResolved

      default int getIntAttributeValueResolved(int index, int minValue, int maxValue) throws ConfigXMLParseException
      Get the value of an attribute as an integer with expressions resolved.
      Parameters:
      index - the index of the attribute
      minValue - the minimum allowed value
      maxValue - the maximum allowed value
      Returns:
      the integer value
      Throws:
      ConfigXMLParseException - if an error occurs
    • getIntListAttributeValue

      default int[] getIntListAttributeValue(int index) throws ConfigXMLParseException
      Get the value of an attribute as an integer list.
      Parameters:
      index - the index of the attribute
      Returns:
      the integer values
      Throws:
      ConfigXMLParseException - if an error occurs
    • getIntListAttributeValueResolved

      default int[] getIntListAttributeValueResolved(int index) throws ConfigXMLParseException
      Get the value of an attribute as an integer list with expressions resolved.
      Parameters:
      index - the index of the attribute
      Returns:
      the integer values
      Throws:
      ConfigXMLParseException - if an error occurs
    • getListAttributeValueAsIterator

      default Iterator<String> getListAttributeValueAsIterator(int index) throws ConfigXMLParseException
      Get the value of an attribute as a space-delimited string list, as an iterator.
      Parameters:
      index - the index of the attribute
      Returns:
      the values
      Throws:
      ConfigXMLParseException - if an error occurs
    • getListAttributeValueAsIteratorResolved

      default Iterator<String> getListAttributeValueAsIteratorResolved(int index) throws ConfigXMLParseException
      /** Get the value of an attribute as a space-delimited string list with expressions resolved, as an iterator.
      Parameters:
      index - the index of the attribute
      Returns:
      the values
      Throws:
      ConfigXMLParseException - if an error occurs
    • getListAttributeValue

      default List<String> getListAttributeValue(int index) throws ConfigXMLParseException
      Get the value of an attribute as a space-delimited string list.
      Parameters:
      index - the index of the attribute
      Returns:
      the values
      Throws:
      ConfigXMLParseException - if an error occurs
    • getListAttributeValueResolved

      default List<String> getListAttributeValueResolved(int index) throws ConfigXMLParseException
      Get the value of an attribute as a space-delimited string list with expressions resolved.
      Parameters:
      index - the index of the attribute
      Returns:
      the values
      Throws:
      ConfigXMLParseException - if an error occurs
    • getListAttributeValueAsArray

      default String[] getListAttributeValueAsArray(int index) throws ConfigXMLParseException
      Get the value of an attribute as a space-delimited string list, as an array.
      Parameters:
      index - the index of the attribute
      Returns:
      the values
      Throws:
      ConfigXMLParseException - if an error occurs
    • getListAttributeValueAsArrayResolved

      default String[] getListAttributeValueAsArrayResolved(int index) throws ConfigXMLParseException
      Get the value of an attribute as a space-delimited string list with expressions resolved, as an array.
      Parameters:
      index - the index of the attribute
      Returns:
      the values
      Throws:
      ConfigXMLParseException - if an error occurs
    • getLongAttributeValue

      default long getLongAttributeValue(int index) throws ConfigXMLParseException
      Get the value of an attribute as a long.
      Parameters:
      index - the index of the attribute
      Returns:
      the long value
      Throws:
      ConfigXMLParseException - if an error occurs
    • getLongAttributeValueResolved

      default long getLongAttributeValueResolved(int index) throws ConfigXMLParseException
      Get the value of an attribute as a long with expressions resolved.
      Parameters:
      index - the index of the attribute
      Returns:
      the long value
      Throws:
      ConfigXMLParseException - if an error occurs
    • getLongAttributeValue

      default long getLongAttributeValue(int index, long minValue, long maxValue) throws ConfigXMLParseException
      Get the value of an attribute as a long.
      Parameters:
      index - the index of the attribute
      minValue - the minimum allowed value
      maxValue - the maximum allowed value
      Returns:
      the long value
      Throws:
      ConfigXMLParseException - if an error occurs
    • getLongAttributeValueResolved

      default long getLongAttributeValueResolved(int index, long minValue, long maxValue) throws ConfigXMLParseException
      Get the value of an attribute as a long with expressions resolved.
      Parameters:
      index - the index of the attribute
      minValue - the minimum allowed value
      maxValue - the maximum allowed value
      Returns:
      the long value
      Throws:
      ConfigXMLParseException - if an error occurs
    • getLongListAttributeValue

      default long[] getLongListAttributeValue(int index) throws ConfigXMLParseException
      Get the value of an attribute as a long integer list.
      Parameters:
      index - the index of the attribute
      Returns:
      the long values
      Throws:
      ConfigXMLParseException - if an error occurs
    • getLongListAttributeValueResolved

      default long[] getLongListAttributeValueResolved(int index) throws ConfigXMLParseException
      Get the value of an attribute as a long integer list with expressions resolved.
      Parameters:
      index - the index of the attribute
      Returns:
      the long values
      Throws:
      ConfigXMLParseException - if an error occurs
    • getBooleanAttributeValue

      default boolean getBooleanAttributeValue(int index)
      Get an attribute value as a boolean. Only the string "true" (case-insensitive) is recognized as a true value; all other strings are considered false.
      Parameters:
      index - the attribute index
      Returns:
      the attribute value
    • getBooleanAttributeValueResolved

      default boolean getBooleanAttributeValueResolved(int index) throws ConfigXMLParseException
      Get an attribute value as a boolean with expressions resolved. Only the string "true" (case-insensitive) is recognized as a true value; all other strings are considered false.
      Parameters:
      index - the attribute index
      Returns:
      the attribute value
      Throws:
      ConfigXMLParseException - if an error occurs
    • getURIAttributeValue

      default URI getURIAttributeValue(int index) throws ConfigXMLParseException
      Get an attribute value as a URI.
      Parameters:
      index - the attribute index
      Returns:
      the attribute value
      Throws:
      ConfigXMLParseException - if the value is not a valid URI
    • getURIAttributeValueResolved

      default URI getURIAttributeValueResolved(int index) throws ConfigXMLParseException
      Get an attribute value as a URI with expressions resolved.
      Parameters:
      index - the attribute index
      Returns:
      the attribute value
      Throws:
      ConfigXMLParseException - if the value is not a valid URI
    • getExpressionAttributeValue

      default Expression getExpressionAttributeValue(int index, Expression.Flag... flags) throws ConfigXMLParseException
      Get an attribute value as a compiled Expression.
      Parameters:
      index - the attribute index
      flags - the expression compilation flags
      Returns:
      the expression, or null if the attribute is not present
      Throws:
      ConfigXMLParseException - if the value is not a valid expression by the given flags
    • getInetAddressAttributeValue

      default InetAddress getInetAddressAttributeValue(int index) throws ConfigXMLParseException
      Get an attribute value as a InetAddress.
      Parameters:
      index - the attribute index
      Returns:
      the attribute value
      Throws:
      ConfigXMLParseException - if the value is not a valid IP address
    • getInetAddressAttributeValueResolved

      default InetAddress getInetAddressAttributeValueResolved(int index) throws ConfigXMLParseException
      Get an attribute value as a InetAddress with expressions resolved.
      Parameters:
      index - the attribute index
      Returns:
      the attribute value
      Throws:
      ConfigXMLParseException - if the value is not a valid IP address
    • getCidrAddressAttributeValue

      default CidrAddress getCidrAddressAttributeValue(int index) throws ConfigXMLParseException
      Get an attribute value as a CidrAddress.
      Parameters:
      index - the attribute index
      Returns:
      the attribute value
      Throws:
      ConfigXMLParseException - if the value is not a valid IP address
    • getCidrAddressAttributeValueResolved

      default CidrAddress getCidrAddressAttributeValueResolved(int index) throws ConfigXMLParseException
      Get an attribute value as a CidrAddress with expressions resolved.
      Parameters:
      index - the attribute index
      Returns:
      the attribute value
      Throws:
      ConfigXMLParseException - if the value is not a valid IP address