Example usage for com.fasterxml.jackson.databind.node ValueNode getClass

List of usage examples for com.fasterxml.jackson.databind.node ValueNode getClass

Introduction

In this page you can find the example usage for com.fasterxml.jackson.databind.node ValueNode getClass.

Prototype

@HotSpotIntrinsicCandidate
public final native Class<?> getClass();

Source Link

Document

Returns the runtime class of this Object .

Usage

From source file:com.redhat.lightblue.util.JsonUtils.java

/**
 * Returns a Java object for a json value node based on the node type.
 *///w  ww . java2  s . c o m
public static Object valueFromJson(ValueNode node) {
    if (node instanceof NullNode) {
        return null;
    } else {
        if (node instanceof TextNode) {
            return node.textValue();
        } else if (node instanceof BooleanNode) {
            return node.booleanValue();
        } else if (node instanceof NumericNode) {
            return node.numberValue();
        } else {
            throw new RuntimeException("Unsupported node type:" + node.getClass().getName());
        }
    }
}