JsonRepresentation

A wrapper around JsonNode that provides some additional helper methods.

API

JsonRepresentation.java
class JsonRepresentation {
  public static final DateTimeFormatter yyyyMMdd;
  public static final DateTimeFormatter yyyyMMddTHHmmssZ;
  public static final DateTimeFormatter _HHmmss;
  JsonRepresentation(JsonNode jsonNode)
  JsonRepresentation jsonAsMap(String keyValuePairsAsJson)
  JsonRepresentation newMap(String... keyValuePairs)
  JsonRepresentation newArray()
  JsonRepresentation newArray(int initialSize)
  JsonNode asJsonNode()
  int size()
  boolean isValue()     (1)
  JsonRepresentation getRepresentation(String pathTemplate, Object... args)
  boolean isArray(String path)
  boolean isArray()
  JsonRepresentation getArray(String path)
  JsonRepresentation asArray()
  JsonRepresentation getArrayEnsured(String path)
  boolean isMap(String path)
  boolean isMap()
  JsonRepresentation getMap(String path)
  JsonRepresentation asMap()
  boolean isNumber(String path)
  boolean isNumber()
  Number asNumber()
  boolean isIntegralNumber(String path)     (2)
  boolean isIntegralNumber()     (3)
  java.util.Date getDate(String path)
  java.util.Date asDate()
  java.util.Date getDateTime(String path)
  java.util.Date asDateTime()
  java.util.Date getTime(String path)
  java.util.Date asTime()
  boolean isBoolean(String path)
  boolean isBoolean()
  Boolean getBoolean(String path)     (4)
  Boolean asBoolean()     (5)
  Byte getByte(String path)     (6)
  Byte asByte()     (7)
  Short getShort(String path)     (8)
  Short asShort()     (9)
  Character getChar(String path)     (10)
  Character asChar()     (11)
  boolean isInt(String path)
  boolean isInt()
  Integer getInt(String path)     (12)
  Integer asInt()     (13)
  boolean isLong(String path)
  boolean isLong()
  Long getLong(String path)     (14)
  Long asLong()     (15)
  Float getFloat(String path)     (16)
  Float asFloat()     (17)
  boolean isDecimal(String path)
  boolean isDecimal()
  Double getDouble(String path)     (18)
  Double asDouble()     (19)
  boolean isBigInteger(String path)
  boolean isBigInteger()
  BigInteger getBigInteger(String path)     (20)
  BigInteger getBigInteger(String path, String formatRequested)     (21)
  BigInteger asBigInteger()     (22)
  BigInteger asBigInteger(String format)
  boolean isBigDecimal(String path)
  boolean isBigDecimal()
  BigDecimal getBigDecimal(String path)     (23)
  BigDecimal getBigDecimal(String path, String formatRequested)     (24)
  BigDecimal asBigDecimal()     (25)
  BigDecimal asBigDecimal(String format)     (26)
  boolean isString(String path)
  boolean isString()
  String getString(String path)     (27)
  String asString()     (28)
  String asArg()
  boolean isLink()
  boolean isLink(String path)
  boolean isLink(JsonNode node)
  LinkRepresentation getLink(String path)     (29)
  LinkRepresentation asLink()     (30)
  boolean isNull()
  Boolean isNull(String path)     (31)
  JsonRepresentation getNull(String path)     (32)
  JsonRepresentation asNull()     (33)
  LinkRepresentation mapValueAsLink()     (34)
  InputStream asInputStream()
  T as(Class<T> cls)     (35)
  String asUrlEncoded()
  JsonRepresentation arrayAdd(Object value)
  JsonRepresentation arrayAdd(JsonRepresentation value)
  JsonRepresentation arrayAdd(String value)
  JsonRepresentation arrayAdd(JsonNode value)
  JsonRepresentation arrayAdd(long value)
  JsonRepresentation arrayAdd(int value)
  JsonRepresentation arrayAdd(double value)
  JsonRepresentation arrayAdd(float value)
  JsonRepresentation arrayAdd(boolean value)
  Stream<JsonRepresentation> streamArrayElements()
  Stream<T> streamArrayElements(Class<T> requiredType)
  JsonRepresentation arrayGet(int i)
  JsonRepresentation arraySetElementAt(int i, JsonRepresentation objectRepr)
  boolean mapHas(String key)
  JsonRepresentation mapPut(String key, List<Object> value)
  JsonRepresentation mapPut(String key, Object value)
  JsonRepresentation mapPutJsonRepresentation(String key, JsonRepresentation value)
  JsonRepresentation mapPutString(String key, String value)
  JsonRepresentation mapPutJsonNode(String key, JsonNode value)
  JsonRepresentation mapPutByte(String key, byte value)
  JsonRepresentation mapPutByteNullable(String key, Byte value)
  JsonRepresentation mapPutShort(String key, short value)
  JsonRepresentation mapPutShortNullable(String key, Short value)
  JsonRepresentation mapPutInt(String key, int value)
  JsonRepresentation mapPutIntNullable(String key, Integer value)
  JsonRepresentation mapPutLong(String key, long value)
  JsonRepresentation mapPutLongNullable(String key, Long value)
  JsonRepresentation mapPutFloat(String key, float value)
  JsonRepresentation mapPutFloatNullable(String key, Float value)
  JsonRepresentation mapPutDouble(String key, double value)
  JsonRepresentation mapPutDoubleNullable(String key, Double value)
  JsonRepresentation mapPutBoolean(String key, boolean value)
  JsonRepresentation mapPutBooleanNullable(String key, Boolean value)
  JsonRepresentation mapPutChar(String key, char value)
  JsonRepresentation mapPutCharNullable(String key, Character value)
  JsonRepresentation mapPutBigInteger(String key, BigInteger value)
  JsonRepresentation mapPutEntries(Iterable<Entry<String, JsonRepresentation>> entries)
  JsonRepresentation mapPutEntry(Entry<String, JsonRepresentation> entry)
  JsonRepresentation mapPutBigDecimal(String key, BigDecimal value)
  JsonRepresentation putFormat(String format)
  JsonRepresentation putExtendedFormat(String format)
  Stream<Map.Entry<String, JsonRepresentation>> streamMapEntries()
  JsonRepresentation ensureArray()     (36)
  int hashCode()
  boolean equals(Object obj)
  String toString()
}
1 isValue()

Node is a value (nb: could be #isNull() null ).

2 isIntegralNumber(String)

Is a long, an int or a BigInteger .

3 isIntegralNumber()

Is a long, an int or a BigInteger .

4 getBoolean(String)

Use #isBoolean(String) to check first, if required.

5 asBoolean()

Use #isBoolean() to check first, if required.

6 getByte(String)

Use #isIntegralNumber(String) to test if number (it is not possible to check if a byte, however).

7 asByte()

Use #isIntegralNumber() to test if number (it is not possible to check if a byte, however).

8 getShort(String)

Use #isIntegralNumber(String) to check if number (it is not possible to check if a short, however).

9 asShort()

Use #isIntegralNumber() to check if number (it is not possible to check if a short, however).

10 getChar(String)

Use #isString(String) to check if string (it is not possible to check if a character, however).

11 asChar()

Use #isString() to check if string (it is not possible to check if a character, however).

12 getInt(String)

Use #isInt(String) to check first, if required.

13 asInt()

Use #isInt() to check first, if required.

14 getLong(String)

Use #isLong(String) to check first, if required.

15 asLong()

Use #isLong() to check first, if required.

16 getFloat(String)

Use #isDecimal(String) to test if a decimal value

17 asFloat()

Use #isNumber() to test if number (it is not possible to check if a float, however).

18 getDouble(String)

Use #isDecimal(String) to check first, if required.

19 asDouble()

Use #isDecimal() to check first, if required.

20 getBigInteger(String)

Use #isBigInteger(String) to check first, if required.

21 getBigInteger(String, String)

Use #isBigInteger(String) to check first, if required.

22 asBigInteger()

Use #isBigInteger() to check first, if required.

23 getBigDecimal(String)

Use #isBigDecimal(String) to check first, if required.

24 getBigDecimal(String, String)

Use #isBigDecimal(String) to check first, if required.

25 asBigDecimal()

Use #isBigDecimal() to check first, if required.

26 asBigDecimal(String)

Use #isBigDecimal() to check first, if required.

27 getString(String)

Use #isString(String) to check first, if required.

28 asString()

Use #isString() to check first, if required.

29 getLink(String)

Use #isLink(String) to check first, if required.

30 asLink()

Use #isLink() to check first, if required.

31 isNull(String)

Indicates that the wrapped node has null value (ie JsonRepresentation#isNull() ), or returns null if there was no node with the provided path.

32 getNull(String)

Either returns a JsonRepresentation that indicates that the wrapped node has null value (ie JsonRepresentation#isNull() ), or returns null if there was no node with the provided path.

33 asNull()

Either returns a JsonRepresentation that indicates that the wrapped node has null value (ie JsonRepresentation#isNull() ), or returns null if there was no node with the provided path.

34 mapValueAsLink()

Convert a representation that contains a single node representing a link into a LinkRepresentation .

35 as(Class)

Convenience to simply "downcast".

36 ensureArray()

A reciprocal of the behaviour of the automatic dereferencing of arrays that occurs when there is only a single instance.

Members

isValue()

Node is a value (nb: could be #isNull() null ).

isIntegralNumber(String)

Is a long, an int or a BigInteger .

isIntegralNumber()

Is a long, an int or a BigInteger .

getBoolean(String)

Use #isBoolean(String) to check first, if required.

asBoolean()

Use #isBoolean() to check first, if required.

getByte(String)

Use #isIntegralNumber(String) to test if number (it is not possible to check if a byte, however).

asByte()

Use #isIntegralNumber() to test if number (it is not possible to check if a byte, however).

getShort(String)

Use #isIntegralNumber(String) to check if number (it is not possible to check if a short, however).

asShort()

Use #isIntegralNumber() to check if number (it is not possible to check if a short, however).

getChar(String)

Use #isString(String) to check if string (it is not possible to check if a character, however).

asChar()

Use #isString() to check if string (it is not possible to check if a character, however).

getInt(String)

Use #isInt(String) to check first, if required.

asInt()

Use #isInt() to check first, if required.

getLong(String)

Use #isLong(String) to check first, if required.

asLong()

Use #isLong() to check first, if required.

getFloat(String)

Use #isDecimal(String) to test if a decimal value

asFloat()

Use #isNumber() to test if number (it is not possible to check if a float, however).

getDouble(String)

Use #isDecimal(String) to check first, if required.

asDouble()

Use #isDecimal() to check first, if required.

getBigInteger(String)

Use #isBigInteger(String) to check first, if required.

getBigInteger(String, String)

Use #isBigInteger(String) to check first, if required.

asBigInteger()

Use #isBigInteger() to check first, if required.

getBigDecimal(String)

Use #isBigDecimal(String) to check first, if required.

getBigDecimal(String, String)

Use #isBigDecimal(String) to check first, if required.

asBigDecimal()

Use #isBigDecimal() to check first, if required.

asBigDecimal(String)

Use #isBigDecimal() to check first, if required.

getString(String)

Use #isString(String) to check first, if required.

asString()

Use #isString() to check first, if required.

Use #isLink(String) to check first, if required.

Use #isLink() to check first, if required.

isNull(String)

Indicates that the wrapped node has null value (ie JsonRepresentation#isNull() ), or returns null if there was no node with the provided path.

getNull(String)

Either returns a JsonRepresentation that indicates that the wrapped node has null value (ie JsonRepresentation#isNull() ), or returns null if there was no node with the provided path.

Use #isNull(String) to check first, if required.

asNull()

Either returns a JsonRepresentation that indicates that the wrapped node has null value (ie JsonRepresentation#isNull() ), or returns null if there was no node with the provided path.

Use #isNull() to check first, if required.

Convert a representation that contains a single node representing a link into a LinkRepresentation .

as(Class)

Convenience to simply "downcast".

In fact, the method creates a new instance of the specified type, which shares the underlying #jsonNode jsonNode .

ensureArray()

A reciprocal of the behaviour of the automatic dereferencing of arrays that occurs when there is only a single instance.