public static Value fromNode(Node source) {
        Value value = source.accept(new NodeVisitor<Value>() {
            @Override
            public Value arrayNode(ArrayNode node) {
                return new ArrayValue(node.getElementsAs(Value::fromNode));
            }

            @Override
            public Value booleanNode(BooleanNode node) {
                return booleanValue(node.getValue());
            }

            @Override
            public Value nullNode(NullNode node) {
                return emptyValue();
            }

            @Override
            public Value numberNode(NumberNode node) {
                int nodeValue = node.getValue().intValue();
                if (node.isFloatingPointNumber() || nodeValue < 0) {
                    throw new RuntimeException("only integers >=0 are supported");
                }
                return Value.integerValue(nodeValue);
            }

            @Override
            public Value objectNode(ObjectNode node) {
                Map<Identifier, Value> out = new LinkedHashMap<>();
                node.getMembers().forEach((name, member) -> out.put(Identifier.of(name), Value.fromNode(member)));
                return Value.recordValue(out);
            }

            @Override
            public Value stringNode(StringNode node) {
                return Value.stringValue(node.getValue());
            }
        });
        value.sourceLocation = source.getSourceLocation();
        return value;
    }
Creates a {@link Value} of a specific type from the given Node information.

@param source the node to deserialize.
@return the created Value.
smithy-rules-engine/src/main/java/software/amazon/smithy/rulesengine/language/evaluation/value/Value.java