WildFly Dynamic Model Representation Concepts: Difference between revisions

From NovaOrdis Knowledge Base
Jump to navigation Jump to search
No edit summary
 
(5 intermediate revisions by the same user not shown)
Line 5: Line 5:


=ModelNode=
=ModelNode=
The primary class of the public management API is <tt>org.jboss.dmr.ModelNode</tt>
A ModelNode is wrapper around a value. The value is typically some basic JDK type. A ModelNode exposes a <tt>getType()</tt> method. This method returns a value of type <tt>org.jboss.dmr.ModelType</tt>, which is an enum of all the valid types of values.
A ModelNode has ''keys''.
The value associated with a key can be obtained with:
<pre>
ModelNode.get(String)
</pre>
and it returns another ModelNode instance. Note that <tt>get()</tt> actually ''mutates'' the node, creating the underlying node if it does not exist.
==Adding Multiple Sub-Nodes==
<pre>
ModelNode n = new ModelNode();
n.get("something).set(...)
n.get("something-else).set(...)
</pre>
==Creating an Undefined Node==
The following will create an UNDEFINED "something" child node.
<pre>
ModelNode n = new ModelNode()
n.get("something");
</pre>
=ModelType=
=Property=


=ModelValue=
=ModelValue=

Latest revision as of 04:29, 5 September 2016

Internal

ModelNode

The primary class of the public management API is org.jboss.dmr.ModelNode

A ModelNode is wrapper around a value. The value is typically some basic JDK type. A ModelNode exposes a getType() method. This method returns a value of type org.jboss.dmr.ModelType, which is an enum of all the valid types of values.

A ModelNode has keys.

The value associated with a key can be obtained with:

ModelNode.get(String)

and it returns another ModelNode instance. Note that get() actually mutates the node, creating the underlying node if it does not exist.

Adding Multiple Sub-Nodes

ModelNode n = new ModelNode();
n.get("something).set(...)
n.get("something-else).set(...)

Creating an Undefined Node

The following will create an UNDEFINED "something" child node.

ModelNode n = new ModelNode()
n.get("something");

ModelType

Property

ModelValue