Class JPropNode
- java.lang.Object
-
- com.fasterxml.jackson.dataformat.javaprop.util.JPropNode
-
public class JPropNode extends java.lang.Object
Value in an ordered tree presentation built from an arbitrarily ordered set of flat input values. Since either index- OR name-based access is to be supported (similar to, say, Javascript objects) -- but only one, not both -- storage is bit of a hybrid. In addition, branches may also have values. So, code does bit coercion as necessary, trying to maintain something consistent and usable at all times, without failure.
-
-
Field Summary
Fields Modifier and Type Field Description protected java.util.TreeMap<java.lang.Integer,JPropNode>
_byIndex
Child entries with integral number index, if any.protected java.util.Map<java.lang.String,JPropNode>
_byName
Child entries accessed with String property name, if any.protected boolean
_hasContents
protected java.lang.String
_value
Value for the path, for leaf nodes; usually null for branches.
-
Constructor Summary
Constructors Constructor Description JPropNode()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description JPropNode
addByIndex(int index)
JPropNode
addByName(java.lang.String name)
java.util.Iterator<JPropNode>
arrayContents()
java.lang.Object
asRaw()
Helper method, mostly for debugging/testing, to convert structure contained into simple List/Map/String equivalent.java.lang.String
getValue()
boolean
isArray()
boolean
isLeaf()
java.util.Iterator<java.util.Map.Entry<java.lang.String,JPropNode>>
objectContents()
Child entries accessed with String property name, if any.JPropNode
setValue(java.lang.String v)
-
-
-
Field Detail
-
_value
protected java.lang.String _value
Value for the path, for leaf nodes; usually null for branches. If both children and value exists, typically need to construct bogus value with empty String key.
-
_byIndex
protected java.util.TreeMap<java.lang.Integer,JPropNode> _byIndex
Child entries with integral number index, if any.
-
_byName
protected java.util.Map<java.lang.String,JPropNode> _byName
Child entries accessed with String property name, if any.
-
_hasContents
protected boolean _hasContents
-
-
Method Detail
-
setValue
public JPropNode setValue(java.lang.String v)
-
addByIndex
public JPropNode addByIndex(int index)
-
addByName
public JPropNode addByName(java.lang.String name)
-
isLeaf
public boolean isLeaf()
-
isArray
public boolean isArray()
-
getValue
public java.lang.String getValue()
-
arrayContents
public java.util.Iterator<JPropNode> arrayContents()
-
objectContents
public java.util.Iterator<java.util.Map.Entry<java.lang.String,JPropNode>> objectContents()
Child entries accessed with String property name, if any.
-
asRaw
public java.lang.Object asRaw()
Helper method, mostly for debugging/testing, to convert structure contained into simple List/Map/String equivalent.
-
-