@JsType public class ModelNode extends Object implements Cloneable
| Type | Property and Description |
|---|---|
Property |
as
Get the value of this node as a property.
|
| Constructor and Description |
|---|
ModelNode() |
| Modifier and Type | Method and Description |
|---|---|
ModelNode |
add()
Add a node to the end of this node's value list and return it.
|
ModelNode |
add(BigDecimal newValue)
Add the given value to the end of this node's value list.
|
ModelNode |
add(BigInteger newValue)
Add the given value to the end of this node's value list.
|
ModelNode |
add(boolean newValue)
Add the given value to the end of this node's value list.
|
ModelNode |
add(byte[] newValue)
Add the given value to the end of this node's value list.
|
ModelNode |
add(double newValue)
Add the given value to the end of this node's value list.
|
ModelNode |
add(int newValue)
Add the given value to the end of this node's value list.
|
ModelNode |
add(long newValue)
Add the given value to the end of this node's value list.
|
ModelNode |
add(ModelNode newValue)
Add a copy of the given value to the end of this node's value list.
|
ModelNode |
add(String newValue)
Add the given value to the end of this node's value list.
|
ModelNode |
add(String propertyName,
BigDecimal propertyValue)
Add a property with the given name and value to the end of this node's value list.
|
ModelNode |
add(String propertyName,
BigInteger propertyValue)
Add a property with the given name and value to the end of this node's value list.
|
ModelNode |
add(String propertyName,
boolean propertyValue)
Add a property with the given name and value to the end of this node's value list.
|
ModelNode |
add(String propertyName,
byte[] propertyValue)
Add a property with the given name and value to the end of this node's value list.
|
ModelNode |
add(String propertyName,
double propertyValue)
Add a property with the given name and value to the end of this node's value list.
|
ModelNode |
add(String propertyName,
int propertyValue)
Add a property with the given name and value to the end of this node's value list.
|
ModelNode |
add(String propertyName,
long propertyValue)
Add a property with the given name and value to the end of this node's value list.
|
ModelNode |
add(String propertyName,
ModelNode propertyValue)
Add a property with the given name and value to the end of this node's value list.
|
ModelNode |
add(String propertyName,
String propertyValue)
Add a property with the given name and value to the end of this node's value list.
|
ModelNode |
addEmptyList()
Add a node of type
ModelType.LIST to the end of this node's value list and return it. |
ModelNode |
addEmptyObject()
Add a node of type
ModelType.OBJECT to the end of this node's value list and return it. |
ModelNode |
addExpression(String newValue)
Add the given expression to the end of this node's value list.
|
Object |
as(ModelType type)
Get the value of this node as
type. |
BigDecimal |
asBigDecimal()
Get the value of this node as a
BigDecimal. |
BigInteger |
asBigInteger()
Get the value of this node as a
BigInteger. |
boolean |
asBoolean()
Get the value of this node as a boolean.
|
boolean |
asBoolean(boolean defVal)
Get the value of this node as a
boolean. |
byte[] |
asBytes()
Get the value of this node as a byte array.
|
double |
asDouble()
Get the value of this node as a
double. |
double |
asDouble(double defVal)
Get the value of this node as an
double. |
int |
asInt()
Get the value of this node as number.
|
int |
asInt(int defVal)
Get the value of this node as number.
|
List<ModelNode> |
asList()
Get the list of entries contained in this object.
|
long |
asLong()
Get the value of this node as a
long. |
long |
asLong(long defVal)
Get the value of this node as a
long. |
ModelNode |
asObject()
Get a copy of this value as an object.
|
Property |
asProperty()
Get the value of this node as a property.
|
List<Property> |
asPropertyList()
Get the value of this node as a property list.
|
String |
asString()
Get the value as a string.
|
ModelType |
asType()
Get the value of this node as a type, expressed using the
ModelType enum. |
ModelNode |
clear()
Clear this node's value and change its type to undefined.
|
ModelNode |
clone()
Clone this model node.
|
boolean |
equals(ModelNode other)
Determine whether this object is equal to another.
|
boolean |
equals(Object other)
Determine whether this object is equal to another.
|
protected void |
format(StringBuilder builder,
int indent,
boolean multiLine) |
static ModelNode |
fromBase64(String encoded)
Creates a new node from a base64 encoded string
|
ModelNode |
get(int index)
Get the child of this node with the given index.
|
ModelNode |
get(String... names)
Recursively get the children of this node with the given names.
|
ModelNode |
get(String name)
Get the child of this node with the given name.
|
String |
getFailureDescription() |
ModelType |
getType()
Get the current type of this node.
|
boolean |
has(int index)
Determine whether this node has a child with the given index.
|
boolean |
has(String key)
Determine whether this node has a child with the given name.
|
boolean |
hasDefined(int index)
Determine whether this node has a defined child with the given index.
|
boolean |
hasDefined(String key)
Determine whether this node has a defined child with the given name.
|
int |
hashCode()
Get the hash code of this node object.
|
boolean |
isDefined()
Determine whether this node is defined.
|
boolean |
isFailure() |
ModelNode[] |
jsAsList() |
Property[] |
jsAsProperties() |
static ModelNode |
jsCreate()
Creates a new undefined model node
|
JsonObject |
jsGetJSONString() |
Set<String> |
keys()
Get the set of keys contained in this object.
|
void |
protect()
Prevent further modifications to this node and its sub-nodes.
|
ModelNode |
remove(String name)
Remove a child of this node, returning the child.
|
ModelNode |
require(int index)
Require the existence of a child of this node with the given index, returning the child.
|
ModelNode |
require(String name)
Require the existence of a child of this node with the given name, returning the child.
|
ModelNode |
resolve()
Return a copy of this model node, with all system property expressions locally resolved.
|
ModelNode |
set(BigDecimal newValue)
Change this node's value to the given value.
|
ModelNode |
set(BigInteger newValue)
Change this node's value to the given value.
|
ModelNode |
set(boolean newValue)
Change this node's value to the given value.
|
ModelNode |
set(byte[] newValue)
Change this node's value to the given value.
|
ModelNode |
set(Collection<ModelNode> newValue)
Change this node's value to a list whose values are copied from the given collection.
|
ModelNode |
set(double newValue)
Change this node's value to the given value.
|
ModelNode |
set(int newValue)
Change this node's value to the given value.
|
ModelNode |
set(long newValue)
Change this node's value to the given value.
|
ModelNode |
set(ModelNode newValue)
Change this node's value to the given value.
|
ModelNode |
set(ModelType newValue)
Change this node's value to the given value.
|
ModelNode |
set(ModelType type,
Object propValue) |
ModelNode |
set(Property newValue)
Change this node's value to the given value.
|
ModelNode |
set(String newValue)
Change this node's value to the given value.
|
ModelNode |
set(String propertyName,
BigDecimal propertyValue)
Change this node's value to a property with the given name and value.
|
ModelNode |
set(String propertyName,
BigInteger propertyValue)
Change this node's value to a property with the given name and value.
|
ModelNode |
set(String propertyName,
boolean propertyValue)
Change this node's value to a property with the given name and value.
|
ModelNode |
set(String propertyName,
byte[] propertyValue)
Change this node's value to a property with the given name and value.
|
ModelNode |
set(String propertyName,
double propertyValue)
Change this node's value to a property with the given name and value.
|
ModelNode |
set(String propertyName,
int propertyValue)
Change this node's value to a property with the given name and value.
|
ModelNode |
set(String propertyName,
long propertyValue)
Change this node's value to a property with the given name and value.
|
ModelNode |
set(String propertyName,
ModelNode propertyValue)
Change this node's value to a property with the given name and value.
|
ModelNode |
set(String propertyName,
ModelType propertyValue)
Change this node's value to a property with the given name and value.
|
ModelNode |
set(String propertyName,
String propertyValue)
Change this node's value to a property with the given name and value.
|
ModelNode |
setEmptyList()
Change this node's value to an empty list.
|
ModelNode |
setEmptyObject()
Change this node's value to an empty object.
|
ModelNode |
setExpression(String newValue)
Change this node's value to the given expression value.
|
ModelNode |
setExpression(String propertyName,
String propertyValue)
Change this node's value to a property with the given name and expression value.
|
String |
toBase64String() |
String |
toJSONString() |
String |
toJSONString(boolean compact)
Get a JSON string representation of this model node, formatted nicely, if requested.
|
String |
toString()
Get a human-readable string representation of this model node, formatted nicely (possibly on multiple lines).
|
void |
writeExternal(org.jboss.hal.dmr.DataOutput out)
Write this node's content in binary format to the given target.
|
public Property asProperty
IllegalArgumentExceptionpublic static ModelNode fromBase64(String encoded)
encoded - The base64 encoded string.@JsIgnore public void protect()
@JsIgnore
public long asLong()
throws IllegalArgumentException
long. Collection types will return the size
of the collection for this value. Other types may attempt a string conversion.IllegalArgumentException - if no conversion is possible@JsIgnore public long asLong(long defVal)
long. Collection types will return the size
of the collection for this value. Other types may attempt a string conversion.defVal - the default value if no conversion is possiblepublic int asInt()
throws IllegalArgumentException
IllegalArgumentException - if no conversion is possible@JsIgnore public int asInt(int defVal)
defVal - the default value if no conversion is possiblepublic boolean asBoolean()
throws IllegalArgumentException
IllegalArgumentException - if no conversion is possible@JsIgnore public boolean asBoolean(boolean defVal)
boolean. Collection types return true for non-empty
collections. Numerical types return true for non-zero values.defVal - the default value if no conversion is possiblepublic String asString()
@JsIgnore
public double asDouble()
throws IllegalArgumentException
double. Collection types will return the size
of the collection for this value. Other types may attempt a string conversion.IllegalArgumentException - if no conversion is possible@JsIgnore public double asDouble(double defVal)
double. Collection types will return the size
of the collection for this value. Other types may attempt a string conversion.defVal - the default value if no conversion is possible@JsIgnore public ModelType asType() throws IllegalArgumentException
ModelType enum. The string
value of this node must be convertible to a type.ModelType valueIllegalArgumentException - if no conversion is possible@JsIgnore public BigDecimal asBigDecimal() throws IllegalArgumentException
BigDecimal. Collection types will return the size
of the collection for this value. Other types may attempt a string conversion.BigDecimal valueIllegalArgumentException - if no conversion is possible@JsIgnore public BigInteger asBigInteger() throws IllegalArgumentException
BigInteger. Collection types will return the size
of the collection for this value. Other types may attempt a string conversion.BigInteger valueIllegalArgumentException - if no conversion is possible@JsIgnore
public byte[] asBytes()
throws IllegalArgumentException
IllegalArgumentException - if no conversion is possiblepublic Property asProperty() throws IllegalArgumentException
IllegalArgumentException@JsIgnore public List<Property> asPropertyList() throws IllegalArgumentException
IllegalArgumentException - if no conversion is possiblepublic ModelNode asObject() throws IllegalArgumentException
Property values will return a single-entry object whose key and value are copied from the property key and value.
List values will attempt to interpolate the list into an object by iterating each item, mapping each property into an object entry and otherwise taking pairs of list entries, converting the first to a string, and using the pair of entries as a single object entry. If an object key appears more than once in the source object, the last key takes precedence.
IllegalArgumentException - if no conversion is possible@JsIgnore public Object as(ModelType type)
type. This method simply delegates to the various asXXX()
methods depending on the specified type.type or null if the type is ModelType.UNDEFINEDIllegalArgumentException - if no conversion is possible@JsProperty public boolean isDefined()
@JsMethod(name="setNumber") public ModelNode set(int newValue)
newValue - the new value@JsIgnore public ModelNode set(long newValue)
newValue - the new value@JsIgnore public ModelNode set(double newValue)
newValue - the new value@JsMethod(name="setBoolean") public ModelNode set(boolean newValue)
newValue - the new valuepublic ModelNode setExpression(String newValue)
newValue - the new value@JsMethod(name="setString") public ModelNode set(String newValue)
newValue - the new value@JsIgnore public ModelNode set(BigDecimal newValue)
newValue - the new value@JsIgnore public ModelNode set(BigInteger newValue)
newValue - the new value@JsMethod(name="setNode") public ModelNode set(ModelNode newValue)
newValue - the new value@JsIgnore public ModelNode set(byte[] newValue)
newValue - the new value@JsIgnore public ModelNode set(ModelType newValue)
newValue - the new value@JsMethod(name="setProperty") public ModelNode set(Property newValue)
newValue - the new value@JsIgnore public ModelNode set(String propertyName, ModelNode propertyValue)
propertyName - the property namepropertyValue - the property value@JsIgnore public ModelNode set(String propertyName, int propertyValue)
propertyName - the property namepropertyValue - the property value@JsIgnore public ModelNode set(String propertyName, long propertyValue)
propertyName - the property namepropertyValue - the property value@JsIgnore public ModelNode set(String propertyName, double propertyValue)
propertyName - the property namepropertyValue - the property value@JsIgnore public ModelNode set(String propertyName, boolean propertyValue)
propertyName - the property namepropertyValue - the property value@JsIgnore public ModelNode set(String propertyName, String propertyValue)
propertyName - the property namepropertyValue - the property value@JsIgnore public ModelNode setExpression(String propertyName, String propertyValue)
propertyName - the property namepropertyValue - the property expression value@JsIgnore public ModelNode set(String propertyName, BigDecimal propertyValue)
propertyName - the property namepropertyValue - the property value@JsIgnore public ModelNode set(String propertyName, BigInteger propertyValue)
propertyName - the property namepropertyValue - the property value@JsIgnore public ModelNode set(String propertyName, byte[] propertyValue)
propertyName - the property namepropertyValue - the property value@JsIgnore public ModelNode set(String propertyName, ModelType propertyValue)
propertyName - the property namepropertyValue - the property value@JsIgnore public ModelNode set(Collection<ModelNode> newValue)
newValue - the list valuepublic ModelNode setEmptyList()
public ModelNode setEmptyObject()
public ModelNode clear()
public ModelNode get(String name)
When called on property values, the name must match the property name.
name - the child nameIllegalArgumentException - if this node does not support getting a child with the given name@JsIgnore public ModelNode require(String name) throws NoSuchElementException
When called on property values, the name must match the property name.
name - the child nameNoSuchElementException - if the element does not exist@JsIgnore public ModelNode remove(String name) throws NoSuchElementException
When called on property values, the name must match the property name.
name - the child nameNoSuchElementException - if the element does not exist@JsIgnore public ModelNode get(int index)
ModelType.LIST.
When called on property values, the index must be zero.
index - the child indexIllegalArgumentException - if this node does not support getting a child with the given index@JsIgnore public ModelNode require(int index)
When called on property values, the index must be zero.
index - the child indexNoSuchElementException - if the element does not exist@JsIgnore public ModelNode add(int newValue)
ModelType.LIST.newValue - the new value to add@JsIgnore public ModelNode add(long newValue)
ModelType.LIST.newValue - the new value to add@JsIgnore public ModelNode add(double newValue)
ModelType.LIST.newValue - the new value to add@JsIgnore public ModelNode add(boolean newValue)
ModelType.LIST.newValue - the new value to add@JsIgnore public ModelNode addExpression(String newValue)
ModelType.LIST.newValue - the new value to add@JsIgnore public ModelNode add(String newValue)
ModelType.LIST.newValue - the new value to add@JsIgnore public ModelNode add(BigDecimal newValue)
ModelType.LIST.newValue - the new value to add@JsIgnore public ModelNode add(BigInteger newValue)
ModelType.LIST.newValue - the new value to add@JsIgnore public ModelNode add(ModelNode newValue)
ModelType.LIST.newValue - the new value to add@JsIgnore public ModelNode add(byte[] newValue)
ModelType.LIST.newValue - the new value to add@JsIgnore public ModelNode add(String propertyName, int propertyValue)
ModelType.LIST.propertyName - the property namepropertyValue - the property value@JsIgnore public ModelNode add(String propertyName, long propertyValue)
ModelType.LIST.propertyName - the property namepropertyValue - the property value@JsIgnore public ModelNode add(String propertyName, double propertyValue)
ModelType.LIST.propertyName - the property namepropertyValue - the property value@JsIgnore public ModelNode add(String propertyName, boolean propertyValue)
ModelType.LIST.propertyName - the property namepropertyValue - the property value@JsIgnore public ModelNode add(String propertyName, String propertyValue)
ModelType.LIST.propertyName - the property namepropertyValue - the property value@JsIgnore public ModelNode add(String propertyName, BigDecimal propertyValue)
ModelType.LIST.propertyName - the property namepropertyValue - the property value@JsIgnore public ModelNode add(String propertyName, BigInteger propertyValue)
ModelType.LIST.propertyName - the property namepropertyValue - the property value@JsIgnore public ModelNode add(String propertyName, ModelNode propertyValue)
ModelType.LIST.propertyName - the property namepropertyValue - the property value@JsIgnore public ModelNode add(String propertyName, byte[] propertyValue)
ModelType.LIST.propertyName - the property namepropertyValue - the property valuepublic ModelNode add()
@JsIgnore public ModelNode addEmptyList()
ModelType.LIST to the end of this node's value list and return it. If this node is
undefined, it will be initialized to be of type ModelType.LIST.@JsIgnore public ModelNode addEmptyObject()
ModelType.OBJECT to the end of this node's value list and return it. If this node is
undefined, it will be initialized to be of type ModelType.LIST.@JsIgnore public boolean has(int index)
index - the indextrue if there is a (possibly undefined) node at the given indexpublic boolean has(String key)
key - the name@JsIgnore public boolean hasDefined(int index)
index - the indextrue if there is a node at the given index and its type is not ModelType.UNDEFINEDpublic boolean hasDefined(String key)
key - the name@JsIgnore public Set<String> keys()
@JsIgnore public List<ModelNode> asList()
@JsIgnore public ModelNode get(String... names)
ModelType.OBJECT.names - the child namesIllegalArgumentException - if a node does not support getting a child with the given name pathpublic String toString()
@JsIgnore public String toJSONString(boolean compact)
compact - Flag that indicates whether or not the string should be all on one line (i.e. true) or
should be printed on multiple lines (false).@JsIgnore public String toJSONString()
public String toBase64String()
@JsIgnore public ModelNode resolve()
@JsIgnore public boolean equals(Object other)
@JsIgnore public boolean equals(ModelNode other)
other - the other objecttrue if they are equal, false otherwise@JsIgnore public int hashCode()
protect()ed, the hash code may
change over time, thus making unprotected nodes unsuitable for use as hash table keys.@JsIgnore public ModelNode clone()
protected void format(StringBuilder builder, int indent, boolean multiLine)
@JsIgnore public ModelType getType()
@JsIgnore public void writeExternal(org.jboss.hal.dmr.DataOutput out)
out - the target to which the content should be written@JsProperty public boolean isFailure()
true if this node has an outcome and the outcome does not equal "success"@JsProperty public String getFailureDescription()
@JsMethod(name="create") public static ModelNode jsCreate()
@JsMethod(name="getJSON") public JsonObject jsGetJSONString()
@JsMethod(name="asProperties") public Property[] jsAsProperties()
Property array@JsMethod(name="asList") public ModelNode[] jsAsList()
Copyright © 2018 JBoss, a division of Red Hat. All rights reserved.