com.github.fge.jackson
Enum NodeType

java.lang.Object
  extended by java.lang.Enum<NodeType>
      extended by com.github.fge.jackson.NodeType
All Implemented Interfaces:
Serializable, Comparable<NodeType>

public enum NodeType
extends Enum<NodeType>

Enumeration for the different types of JSON instances which can be encountered.

In addition to what the JSON RFC defines, JSON Schema has an integer type, which is a numeric value without any fraction or exponent part.

NOTE: will disappear in Jackson 2.2.x, which has an equivalent enumeration


Enum Constant Summary
ARRAY
          Array nodes
BOOLEAN
          Boolean nodes
INTEGER
          Integer nodes
NULL
          Number nodes (ie, decimal numbers)
NUMBER
          Object nodes
OBJECT
          Null nodes
STRING
          String nodes
 
Method Summary
static NodeType fromName(String name)
          Given a type name, return the corresponding node type
static NodeType getNodeType(JsonNode node)
          Given a JsonNode as an argument, return its type.
 String toString()
           
static NodeType valueOf(String name)
          Returns the enum constant of this type with the specified name.
static NodeType[] values()
          Returns an array containing the constants of this enum type, in the order they are declared.
 
Methods inherited from class java.lang.Enum
clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, valueOf
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Enum Constant Detail

ARRAY

public static final NodeType ARRAY
Array nodes


BOOLEAN

public static final NodeType BOOLEAN
Boolean nodes


INTEGER

public static final NodeType INTEGER
Integer nodes


NULL

public static final NodeType NULL
Number nodes (ie, decimal numbers)


NUMBER

public static final NodeType NUMBER
Object nodes


OBJECT

public static final NodeType OBJECT
Null nodes


STRING

public static final NodeType STRING
String nodes

Method Detail

values

public static NodeType[] values()
Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:
for (NodeType c : NodeType.values())
    System.out.println(c);

Returns:
an array containing the constants of this enum type, in the order they are declared

valueOf

public static NodeType valueOf(String name)
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)

Parameters:
name - the name of the enum constant to be returned.
Returns:
the enum constant with the specified name
Throws:
IllegalArgumentException - if this enum type has no constant with the specified name
NullPointerException - if the argument is null

toString

public String toString()
Overrides:
toString in class Enum<NodeType>

fromName

public static NodeType fromName(String name)
Given a type name, return the corresponding node type

Parameters:
name - the type name
Returns:
the node type, or null if not found

getNodeType

public static NodeType getNodeType(JsonNode node)
Given a JsonNode as an argument, return its type. The argument MUST NOT BE NULL, and MUST NOT be a MissingNode

Parameters:
node - the node to determine the type of
Returns:
the type for this node