ModelNode node = ModelNode.fromJSONString("{\"value\": 42}"); int value = node.get("value").asInt(); System.out.println(value); // Output: 42
ModelNode node = ModelNode.fromJSONString("{\"value\": \"not an integer\"}"); int value = node.get("value").asInt();In this example, we attempt to get the "value" node from the ModelNode and convert it to an integer, but it will throw an exception because the value is not an integer. The org.jboss.dmr ModelNode class is part of the JBoss Application Server libraries.