Class DERPath


  • public class DERPath
    extends java.lang.Object
    Describes paths to individual elements of an encoded DER object that may be addressed during parsing to associate a parsed element with a handler to handle that element. Consider the following production rule for a complex type that may be DER encoded:
    
         BankAccountSet ::= SET OF {
           account BankAccount
         }
    
         BankAccount ::= SEQUENCE OF {
           accountNumber OCTET STRING,
           accountName OCTET STRING,
           accountType AccountType,
           balance REAL
         }
    
         AccountType ::= ENUM {
           checking (0),
           savings (1)
         }
    
     

    Given an instance of BankAccountSet with two elements, the path to the balance of each bank account in the set is given by the following expression:

    /SET/SEQ/REAL

    Individual child elements can be accessed by explicitly mentioning the index of the item relative to its parent. For example, the second bank account in the set can be accessed as follows:

    /SET/SEQ[1]

    Node names in DER paths are constrained to the following:

    Author:
    Middleware Services
    See Also:
    DERParser
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static java.lang.String PATH_SEPARATOR
      Separates nodes in a path specification.
    • Constructor Summary

      Constructors 
      Constructor Description
      DERPath()
      Creates an empty path specification.
      DERPath​(java.lang.String pathSpec)
      Creates a path specification from its string representation.
      DERPath​(DERPath path)
      Copy constructor.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean equals​(java.lang.Object o)  
      int getSize()
      Gets the number of nodes in the path.
      int hashCode()  
      boolean isEmpty()
      Determines whether the path contains any nodes.
      java.lang.String peekNode()
      Examines the first node in the path without removing it.
      java.lang.String popNode()
      Removes the last node in the path.
      DERPath pushNode​(java.lang.String name)
      Appends a node to the path.
      DERPath pushNode​(java.lang.String name, int index)
      Appends a node to the path with the given child index.
      java.lang.String toString()  
      • Methods inherited from class java.lang.Object

        clone, finalize, getClass, notify, notifyAll, wait, wait, wait
    • Field Detail

      • PATH_SEPARATOR

        public static final java.lang.String PATH_SEPARATOR
        Separates nodes in a path specification.
        See Also:
        Constant Field Values
    • Constructor Detail

      • DERPath

        public DERPath()
        Creates an empty path specification.
      • DERPath

        public DERPath​(DERPath path)
        Copy constructor.
        Parameters:
        path - to read nodes from
      • DERPath

        public DERPath​(java.lang.String pathSpec)
        Creates a path specification from its string representation.
        Parameters:
        pathSpec - string representation of a path, e.g. /SEQ[1]/CHOICE.
    • Method Detail

      • pushNode

        public DERPath pushNode​(java.lang.String name)
        Appends a node to the path.
        Parameters:
        name - of the path element to add
        Returns:
        This instance with new node appended.
      • pushNode

        public DERPath pushNode​(java.lang.String name,
                                int index)
        Appends a node to the path with the given child index.
        Parameters:
        name - of the path element to add
        index - child index
        Returns:
        This instance with new node appended.
      • peekNode

        public java.lang.String peekNode()
        Examines the first node in the path without removing it.
        Returns:
        first node in the path or null if no nodes remain
      • popNode

        public java.lang.String popNode()
        Removes the last node in the path.
        Returns:
        last node in the path or null if no more nodes remain.
      • getSize

        public int getSize()
        Gets the number of nodes in the path.
        Returns:
        node count.
      • isEmpty

        public boolean isEmpty()
        Determines whether the path contains any nodes.
        Returns:
        True if path contains 0 nodes, false otherwise.
      • equals

        public boolean equals​(java.lang.Object o)
        Overrides:
        equals in class java.lang.Object
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object