public class DERPath extends Object
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:
DERParser
Modifier and Type | Class and Description |
---|---|
(package private) static class |
DERPath.Node
DER path node encapsulates the path name and its location among other children that share a common parent.
|
Modifier and Type | Field and Description |
---|---|
private static int |
HASH_CODE_SEED
hash code seed.
|
private static Pattern |
NODE_PATTERN
General pattern for DER path nodes.
|
private Deque<DERPath.Node> |
nodeStack
Describes the path as a FIFO set of nodes.
|
static String |
PATH_SEPARATOR
Separates nodes in a path specification.
|
Constructor and Description |
---|
DERPath()
Creates an empty path specification.
|
DERPath(DERPath path)
Copy constructor.
|
DERPath(String pathSpec)
Creates a path specification from its string representation.
|
Modifier and Type | Method and Description |
---|---|
boolean |
equals(Object o) |
int |
getSize()
Gets the number of nodes in the path.
|
int |
hashCode() |
boolean |
isEmpty()
Determines whether the path contains any nodes.
|
String |
peekNode()
Examines the last node in the path without removing it.
|
String |
popNode()
Removes the last node in the path.
|
DERPath |
pushNode(String name)
Appends a node to the path.
|
DERPath |
pushNode(String name,
int index)
Appends a node to the path with the given child index.
|
(package private) static DERPath.Node |
toNode(String node)
Converts a string representation of a node into a
DERPath.Node object. |
String |
toString() |
public static final String PATH_SEPARATOR
private static final Pattern NODE_PATTERN
private static final int HASH_CODE_SEED
private final Deque<DERPath.Node> nodeStack
public DERPath()
public DERPath(DERPath path)
path
- to read nodes frompublic DERPath(String pathSpec)
pathSpec
- string representation of a path, e.g. /SEQ[1]/CHOICE.public DERPath pushNode(String name)
name
- of the path element to addpublic DERPath pushNode(String name, int index)
name
- of the path element to addindex
- child indexpublic String peekNode()
public String popNode()
public int getSize()
public boolean isEmpty()
static DERPath.Node toNode(String node)
DERPath.Node
object.node
- String representation of node.IllegalArgumentException
- for an invalid node name.Copyright © 2003-2019 Virginia Tech. All Rights Reserved.