public class DocumentNode
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
protected java.beans.PropertyChangeSupport |
change
This slightly modified property change support object also forwards each event upwards directly to the model,
which is what triggers the model to know when to run the validation routine.
|
Constructor and Description |
---|
DocumentNode(DocumentNode copy) |
DocumentNode(NodeType type) |
Modifier and Type | Method and Description |
---|---|
void |
addPropertyChangeListener(java.beans.PropertyChangeListener listener) |
void |
addPropertyChangeListener(java.lang.String propertyName,
java.beans.PropertyChangeListener listener) |
void |
appendChild(DocumentNode newNode)
Adds a new child to this node.
|
java.util.Optional<DocumentNode> |
findChild(java.lang.Object key) |
java.util.Optional<DocumentNode> |
findNode(JsonPath path) |
java.util.Optional<JsonSchema> |
findSchema()
Finds the schema object for this node, if any
|
int |
getChildCount() |
java.util.Iterator<DocumentNode> |
getChildren() |
java.lang.Object |
getKey() |
int |
getKeyAsIndex() |
java.lang.String |
getKeyAsString() |
DocumentModel |
getModel() |
DocumentNode |
getParent() |
JsonPath |
getPath() |
QualityCode |
getQuality() |
NodeType |
getType() |
java.util.Collection<ValidationResults.ValidationError> |
getValidationErrors() |
java.lang.Object |
getValue() |
int |
indexOf(DocumentNode childNode) |
void |
insertChild(int index,
DocumentNode newNode)
Inserts a child an a specific location.
|
boolean |
isArray() |
boolean |
isNull() |
boolean |
isObject() |
boolean |
isObjectOrArray() |
boolean |
isRoot() |
void |
removeChild(DocumentNode node) |
void |
removePropertyChangeListener(java.beans.PropertyChangeListener listener) |
void |
removePropertyChangeListener(java.lang.String propertyName,
java.beans.PropertyChangeListener listener) |
void |
reorderBySchema(JsonPath path,
JsonSchema schema)
Re-order this node's children, if it is an object with child nodes, according to the schema
|
void |
replaceChildren(java.util.List<DocumentNode> newChildArray) |
void |
replaceChildren(java.util.Map<java.lang.String,DocumentNode> newChildMap) |
void |
repositionNode(DocumentNode child,
int newIndex) |
void |
setChild(int index,
DocumentNode newNode)
Overwrites the child node at the given index with this node.
|
void |
setKey(java.lang.Object newKey) |
void |
setQuality(QualityCode quality) |
void |
setType(NodeType type) |
void |
setType(NodeType type,
boolean retainChildren)
Sets the type, with an option to discard any children.
|
void |
setValidationErrors(java.util.Collection<ValidationResults.ValidationError> validationErrors) |
void |
setValue(java.lang.Object value) |
void |
setValueDocument(DocumentElement element) |
void |
setValueJson(com.google.gson.JsonElement element)
Sets the value, element is expected to be json null or primitive.
|
DocumentElement |
toDocument() |
com.google.gson.JsonElement |
toJson() |
java.lang.String |
toString() |
protected final java.beans.PropertyChangeSupport change
public DocumentNode(NodeType type)
public DocumentNode(DocumentNode copy)
public DocumentModel getModel()
public java.util.Optional<JsonSchema> findSchema()
public java.util.Optional<DocumentNode> findChild(java.lang.Object key)
public java.util.Optional<DocumentNode> findNode(JsonPath path)
public void setType(NodeType type)
public void setType(NodeType type, boolean retainChildren)
public JsonPath getPath()
public com.google.gson.JsonElement toJson()
public DocumentElement toDocument()
public boolean isRoot()
public NodeType getType()
public java.lang.Object getKey()
public java.lang.String getKeyAsString()
public int getKeyAsIndex()
public void setKey(java.lang.Object newKey)
public java.lang.Object getValue()
public void setValue(java.lang.Object value)
public QualityCode getQuality()
public void setQuality(QualityCode quality)
public boolean isNull()
public boolean isObjectOrArray()
public boolean isObject()
public boolean isArray()
public DocumentNode getParent()
public int getChildCount()
public java.util.Iterator<DocumentNode> getChildren()
public void appendChild(DocumentNode newNode)
public void insertChild(int index, DocumentNode newNode)
IllegalArgumentException
if given a bogus index.public void setChild(int index, DocumentNode newNode)
public int indexOf(DocumentNode childNode)
public void repositionNode(DocumentNode child, int newIndex)
public void removeChild(DocumentNode node)
public void replaceChildren(java.util.Map<java.lang.String,DocumentNode> newChildMap)
public void replaceChildren(java.util.List<DocumentNode> newChildArray)
public void reorderBySchema(@Nonnull JsonPath path, @Nonnull JsonSchema schema)
path
- Path to this node relative to the given schmeapublic void setValueJson(com.google.gson.JsonElement element)
public void setValueDocument(DocumentElement element)
public java.util.Collection<ValidationResults.ValidationError> getValidationErrors()
public void setValidationErrors(java.util.Collection<ValidationResults.ValidationError> validationErrors)
public java.lang.String toString()
toString
in class java.lang.Object
public void addPropertyChangeListener(java.beans.PropertyChangeListener listener)
public void removePropertyChangeListener(java.beans.PropertyChangeListener listener)
public void addPropertyChangeListener(java.lang.String propertyName, java.beans.PropertyChangeListener listener)
public void removePropertyChangeListener(java.lang.String propertyName, java.beans.PropertyChangeListener listener)