Class JsonElement
- java.lang.Object
-
- io.wcm.caravan.io.jsontransform.element.JsonElement
-
@ProviderType public final class JsonElement extends Object
A simple bean representing a JSON stream element.
-
-
Field Summary
Fields Modifier and Type Field Description static JsonElement
DEFAULT_END_ARRAY
The default JSON array end elementstatic JsonElement
DEFAULT_END_OBJECT
The default JSON object end elementstatic JsonElement
DEFAULT_START_ARRAY
The default JSON array start elementstatic JsonElement
DEFAULT_START_OBJECT
The default JSON object start element
-
Constructor Summary
Constructors Constructor Description JsonElement(String key, Object value, JsonElementType type)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
equals(Object obj)
String
getKey()
JsonElementType
getType()
Object
getValue()
int
hashCode()
boolean
isClosingElement()
boolean
isStartingElement()
static JsonElement
nullValue(String key)
Creator for JSON value element with value being NULL.static JsonElement
startArray(String key)
Creator for JSON array start element with given keystatic JsonElement
startObject(String key)
Creator for JSON object start element with given keyString
toString()
static JsonElement
value(Object value)
Creator for JSON value element with given value and no key.static JsonElement
value(String key, Object value)
Creator for JSON value element with given key and value
-
-
-
Field Detail
-
DEFAULT_START_OBJECT
public static final JsonElement DEFAULT_START_OBJECT
The default JSON object start element
-
DEFAULT_START_ARRAY
public static final JsonElement DEFAULT_START_ARRAY
The default JSON array start element
-
DEFAULT_END_OBJECT
public static final JsonElement DEFAULT_END_OBJECT
The default JSON object end element
-
DEFAULT_END_ARRAY
public static final JsonElement DEFAULT_END_ARRAY
The default JSON array end element
-
-
Constructor Detail
-
JsonElement
public JsonElement(String key, Object value, JsonElementType type)
- Parameters:
key
- JSON element namevalue
- JSON element valuetype
- JSON element type
-
-
Method Detail
-
nullValue
public static JsonElement nullValue(String key)
Creator for JSON value element with value being NULL.- Parameters:
key
- JSON element name- Returns:
- JSON value element with value NULL
-
value
public static JsonElement value(Object value)
Creator for JSON value element with given value and no key.- Parameters:
value
- JSON element value- Returns:
- JSON value element
-
value
public static JsonElement value(String key, Object value)
Creator for JSON value element with given key and value- Parameters:
key
- JSON element namevalue
- JSON element value- Returns:
- JSON value element
-
startObject
public static JsonElement startObject(String key)
Creator for JSON object start element with given key- Parameters:
key
- JSON element name- Returns:
- JSON object start element
-
startArray
public static JsonElement startArray(String key)
Creator for JSON array start element with given key- Parameters:
key
- JSON element name- Returns:
- JSON array start element
-
getKey
public String getKey()
- Returns:
- the key
-
getValue
public Object getValue()
- Returns:
- the value
-
getType
public JsonElementType getType()
- Returns:
- the type
-
isStartingElement
public boolean isStartingElement()
- Returns:
- True if is a starting element
-
isClosingElement
public boolean isClosingElement()
- Returns:
- True if is a closing element
-
-