Class DefaultConfigurationKey.KeyIterator

java.lang.Object
org.apache.commons.configuration2.tree.DefaultConfigurationKey.KeyIterator
All Implemented Interfaces:
Cloneable, Iterator<Object>
Enclosing class:
DefaultConfigurationKey

A specialized iterator class for tokenizing a configuration key. This class implements the normal iterator interface. In addition it provides some specific methods for configuration keys.
  • Constructor Summary Link icon

    Constructors
    Constructor
    Description
     
  • Method Summary Link icon

    Modifier and Type
    Method
    Description
    Creates a clone of this object.
    Returns the current key of the iteration (without skipping to the next element).
    currentKey(boolean decorated)
    Returns the current key of the iteration (without skipping to the next element).
    int
    Gets the index value of the current key.
    boolean
    Returns a flag if the current key has an associated index.
    boolean
    Checks if there is a next element.
    boolean
    Returns a flag if the current key is an attribute.
    boolean
    Returns a flag whether the current key refers to a property (i.e. is no special attribute key).
    Returns the next object in the iteration.
    Returns the next key part of this configuration key.
    nextKey(boolean decorated)
    Returns the next key part of this configuration key.
    void
    Removes the current object in the iteration.

    Methods inherited from class java.lang.Object Link icon

    equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface java.util.Iterator Link icon

    forEachRemaining
  • Constructor Details Link icon

  • Method Details Link icon

    • clone Link icon

      public Object clone()
      Creates a clone of this object.
      Overrides:
      clone in class Object
      Returns:
      a clone of this object
    • currentKey Link icon

      public String currentKey()
      Returns the current key of the iteration (without skipping to the next element). This is the same key the previous next() call had returned. (Short form of currentKey(false).
      Returns:
      the current key
    • currentKey Link icon

      public String currentKey(boolean decorated)
      Returns the current key of the iteration (without skipping to the next element). The boolean parameter indicates wheter a decorated key should be returned. This affects only attribute keys: if the parameter is false, the attribute markers are stripped from the key; if it is true, they remain.
      Parameters:
      decorated - a flag if the decorated key is to be returned
      Returns:
      the current key
    • getIndex Link icon

      public int getIndex()
      Gets the index value of the current key. If the current key does not have an index, return value is -1. This method can be called after next().
      Returns:
      the index value of the current key
    • hasIndex Link icon

      public boolean hasIndex()
      Returns a flag if the current key has an associated index. This method can be called after next().
      Returns:
      a flag if the current key has an index
    • hasNext Link icon

      public boolean hasNext()
      Checks if there is a next element.
      Specified by:
      hasNext in interface Iterator<Object>
      Returns:
      a flag if there is a next element
    • isAttribute Link icon

      public boolean isAttribute()
      Returns a flag if the current key is an attribute. This method can be called after next().
      Returns:
      a flag if the current key is an attribute
    • isPropertyKey Link icon

      public boolean isPropertyKey()
      Returns a flag whether the current key refers to a property (i.e. is no special attribute key). Usually this method will return the opposite of isAttribute(), but if the delimiters for normal properties and attributes are set to the same string, it is possible that both methods return true.
      Returns:
      a flag if the current key is a property key
      See Also:
    • next Link icon

      public Object next()
      Returns the next object in the iteration.
      Specified by:
      next in interface Iterator<Object>
      Returns:
      the next object
    • nextKey Link icon

      public String nextKey()
      Returns the next key part of this configuration key. This is a short form of nextKey(false).
      Returns:
      the next key part
    • nextKey Link icon

      public String nextKey(boolean decorated)
      Returns the next key part of this configuration key. The boolean parameter indicates wheter a decorated key should be returned. This affects only attribute keys: if the parameter is false, the attribute markers are stripped from the key; if it is true, they remain.
      Parameters:
      decorated - a flag if the decorated key is to be returned
      Returns:
      the next key part
    • remove Link icon

      public void remove()
      Removes the current object in the iteration. This method is not supported by this iterator type, so an exception is thrown.
      Specified by:
      remove in interface Iterator<Object>