Class InstancePath

Object
com.tailf.conf.InstancePath
Direct Known Subclasses:
ConfPath, ConfXPath

public abstract class InstancePath extends Object

Class Representing an path. A Path can be either a schema path or an instance path. A schema path points to an element in the model while an instance path points to an element in the instantiated model.

The difference is that in the instance tree both elements and data values are needed to point out a instance element.

There are several ways to represent a path which are supported by this class. The two most important being as a String or as a array of ConfTag/ConfKey values.

  • Instance of ConfEList - Applications usually does not have to deal with paths that are instances of ConfEList.
    Constructors that have this type is usually for internal use: InstancePath(ConfEBinary),InstancePath(ConfEList), InstancePath(ConfObject[])

  • Reverted array of ConfObject ConfObject[] where each element is either of the type ConfTag or ConfKey. To determine which type a instanceof test is required. Usually the application need to deal with this representations in different callback implementations and it is always reverted. The library invokes the user defined callbacks with this type of representation as one of the parameters.

    Application is seldom required to construct such arrays.

  • Constructor Details

    • InstancePath

      public InstancePath(ConfEBinary o) throws ConfException
      Initialize a InstancePath. (This constructor is rarely used for applications; usually for internal use)
      Parameters:
      o - element constitute a InstancePath
      Throws:
      ConfException
    • InstancePath

      public InstancePath(ConfEList o)
      Initialize a InstancePath. (This constructor is rarely used for applications; usually for internal uses)
      Parameters:
      o - element (reversed) constitute a InstancePath
    • InstancePath

      public InstancePath(ConfObject[] kp)
      Initializes a new instance of this class from a given reverted ConfObject[] keypath where elements is either ConfTag or ConfKey.
      Parameters:
      kp - reverted keypath
    • InstancePath

      public InstancePath(MountIdInterface mountGetter, ConfObject[] kp)
  • Method Details

    • encode

      public ConfEList encode()
      Returns the path encoded as an ConfEList. This method is used internally.
      Returns:
      ConfEList representation of this path
    • encodeIKP

      public ConfEList encodeIKP()
      Returns the path as ConfEList in IKP format. This method is used internally.
      Returns:
      ConfEList representation of this path
    • getKP

      public ConfObject[] getKP() throws ConfException

      Returns an array of ConfTag and ConfKey objects which represents the path in reverted order.

      This method requires that the path is absolute and that the schema prefix for the root element is defined, if not a ConfException is thrown.

      The ConfKey is composed of the proper ConfValue types which are determined by the loaded schema. However, if this the schema information is not available, and the type therefore cannot be determined the key elements are defaulted to ConfBinary.

      Returns:
      reverted array representation of this InstancePath
      Throws:
      ConfException - If schema information is not loaded, the path is not valid or the parsed path has no namespace information.
    • atoString

      @Deprecated public String atoString()
      Deprecated.
      This is a deprecated method. It returns the string representation of the erlang type encoded path.
      Returns:
      Erlang encoded path string
    • isKey

      public boolean isKey()
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • isRel

      public boolean isRel()
      Check if this is a relative path.
      Returns:
      true if this is a relative path
    • toXPathString

      public String toXPathString()
      Returns this path object as an XPath string.
      Returns:
      XPath String representation
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Returns a hash code value for the path. This method is supported for the benefit of hash tables such as those provided by java.util.Hashtable. The hash code is calculated from its component of ConfTag and ConfKey.
      Overrides:
      hashCode in class Object
      Returns:
      a hash code value for this object.
    • getCSNode

      public MaapiSchemas.CSNode getCSNode()
      Returns MaapiSchemas node corresponding to the path. The path needs to be absolute and MaapiSchemas need to be loaded.
      Returns:
      CSNode if the node exists in the schema, null otherwise
    • getMountIdGetter

      public MountIdInterface getMountIdGetter()
    • setMountIdGetter

      public void setMountIdGetter(MountIdInterface mountGetter) throws ConfException
      Throws:
      ConfException
    • isParsingDeferred

      public boolean isParsingDeferred()
    • getLatestMountId

      public List<String> getLatestMountId()