ModelNode node = new ModelNode(); node.get("name").set("John"); node.get("age").set(30); Property property = node.asProperty(); // Convert the node to a Property System.out.println(property.getName()); // Output: "name" System.out.println(property.getValue()); // Output: A ModelNode representing "John"
ModelNode node = new ModelNode(); node.get("address").get("street").set("123 Main St."); node.get("address").get("city").set("New York"); node.get("address").get("state").set("NY"); MapIn this example, we create a more complex ModelNode with a nested address node. We then convert the top-level node into a Property, and use its name and value to populate a Map. The resulting Map contains a nested structure representing the original ModelNode. Based on its package name, org.jboss.dmr, the ModelNode class is likely part of the JBoss Application Server or related libraries.map = new HashMap<>(); Property property = node.asProperty(); map.put(property.getName(), property.getValue()); System.out.println(map); // Output: {address={street=123 Main St., city=New York, state=NY}}