Package net.royalur.notation
Class JsonHelper
java.lang.Object
net.royalur.notation.JsonHelper
Contains type checking helper methods for retrieving JSON values,
as Jackson doesn't support that for some reason.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classstatic classstatic class -
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionstatic com.fasterxml.jackson.databind.node.ArrayNodecheckedToArray(com.fasterxml.jackson.databind.JsonNode value, String key) static booleancheckedToBool(com.fasterxml.jackson.databind.JsonNode value, String key) static charcheckedToChar(String value, String key) static doublecheckedToDouble(com.fasterxml.jackson.databind.JsonNode value, String key) static floatcheckedToFloat(com.fasterxml.jackson.databind.JsonNode value, String key) static intcheckedToInt(com.fasterxml.jackson.databind.JsonNode value, String key) static longcheckedToLong(com.fasterxml.jackson.databind.JsonNode value, String key) static com.fasterxml.jackson.databind.JsonNodecheckedToNumber(com.fasterxml.jackson.databind.JsonNode value, String key) static com.fasterxml.jackson.databind.node.ObjectNodecheckedToObject(com.fasterxml.jackson.databind.JsonNode value, String key) static StringcheckedToString(com.fasterxml.jackson.databind.JsonNode value, String key) static StringencodeDate(Instant instant) static StringencodeNullableDate(Instant instant) static Instantstatic com.fasterxml.jackson.databind.node.ArrayNodestatic com.fasterxml.jackson.databind.JsonNodereadArrayEntry(com.fasterxml.jackson.databind.node.ArrayNode json, int index) static com.fasterxml.jackson.databind.node.ObjectNodereadArrayObjectEntry(com.fasterxml.jackson.databind.node.ArrayNode json, int index) static booleanstatic booleanreadBoolWithDefault(com.fasterxml.jackson.databind.node.ObjectNode json, String key, boolean defaultValue) static charstatic charreadCharWithDefault(com.fasterxml.jackson.databind.node.ObjectNode json, String key, char defaultValue) static InstantReads an ISO date string.static InstantreadDateWithDefault(com.fasterxml.jackson.databind.node.ObjectNode json, String key, Instant defaultValue) Reads an ISO date string.static doublereadDouble(com.fasterxml.jackson.databind.node.ObjectNode json, String key) static doublereadDoubleWithDefault(com.fasterxml.jackson.databind.node.ObjectNode json, String key, double defaultValue) static floatstatic floatreadFloatWithDefault(com.fasterxml.jackson.databind.node.ObjectNode json, String key, float defaultValue) static intstatic intreadIntWithDefault(com.fasterxml.jackson.databind.node.ObjectNode json, String key, int defaultValue) static longstatic longreadLongWithDefault(com.fasterxml.jackson.databind.node.ObjectNode json, String key, long defaultValue) static com.fasterxml.jackson.databind.node.ArrayNodereadNullableArray(com.fasterxml.jackson.databind.node.ObjectNode json, String key) static BooleanreadNullableBool(com.fasterxml.jackson.databind.node.ObjectNode json, String key) static CharacterreadNullableChar(com.fasterxml.jackson.databind.node.ObjectNode json, String key) static InstantreadNullableDate(com.fasterxml.jackson.databind.node.ObjectNode json, String key) Reads an ISO date string.static DoublereadNullableDouble(com.fasterxml.jackson.databind.node.ObjectNode json, String key) static FloatreadNullableFloat(com.fasterxml.jackson.databind.node.ObjectNode json, String key) static IntegerreadNullableInt(com.fasterxml.jackson.databind.node.ObjectNode json, String key) static LongreadNullableLong(com.fasterxml.jackson.databind.node.ObjectNode json, String key) static com.fasterxml.jackson.databind.JsonNodereadNullableNumber(com.fasterxml.jackson.databind.node.ObjectNode json, String key) static com.fasterxml.jackson.databind.node.ObjectNodereadNullableObject(com.fasterxml.jackson.databind.node.ObjectNode json, String key) static StringreadNullableString(com.fasterxml.jackson.databind.node.ObjectNode json, String key) static com.fasterxml.jackson.databind.JsonNodereadNullableValue(com.fasterxml.jackson.databind.node.ObjectNode json, String key) static com.fasterxml.jackson.databind.JsonNodereadNumber(com.fasterxml.jackson.databind.node.ObjectNode json, String key) static com.fasterxml.jackson.databind.node.ObjectNodereadObject(com.fasterxml.jackson.databind.node.ObjectNode json, String key) static StringreadString(com.fasterxml.jackson.databind.node.ObjectNode json, String key) static StringreadStringWithDefault(com.fasterxml.jackson.databind.node.ObjectNode json, String key, String defaultValue) static com.fasterxml.jackson.databind.JsonNode
-
Field Details
-
MAX_FLOAT_READ_EPSILON
public static final double MAX_FLOAT_READ_EPSILON- See Also:
-
MAX_DOUBLE_READ_EPSILON
-
-
Method Details
-
readNullableValue
@Nullable public static com.fasterxml.jackson.databind.JsonNode readNullableValue(com.fasterxml.jackson.databind.node.ObjectNode json, String key) -
readValue
public static com.fasterxml.jackson.databind.JsonNode readValue(com.fasterxml.jackson.databind.node.ObjectNode json, String key) -
checkedToObject
public static com.fasterxml.jackson.databind.node.ObjectNode checkedToObject(com.fasterxml.jackson.databind.JsonNode value, String key) -
readObject
public static com.fasterxml.jackson.databind.node.ObjectNode readObject(com.fasterxml.jackson.databind.node.ObjectNode json, String key) -
readNullableObject
@Nullable public static com.fasterxml.jackson.databind.node.ObjectNode readNullableObject(com.fasterxml.jackson.databind.node.ObjectNode json, String key) -
checkedToArray
public static com.fasterxml.jackson.databind.node.ArrayNode checkedToArray(com.fasterxml.jackson.databind.JsonNode value, String key) -
readArray
public static com.fasterxml.jackson.databind.node.ArrayNode readArray(com.fasterxml.jackson.databind.node.ObjectNode json, String key) -
readNullableArray
@Nullable public static com.fasterxml.jackson.databind.node.ArrayNode readNullableArray(com.fasterxml.jackson.databind.node.ObjectNode json, String key) -
readArrayEntry
public static com.fasterxml.jackson.databind.JsonNode readArrayEntry(com.fasterxml.jackson.databind.node.ArrayNode json, int index) -
readArrayObjectEntry
public static com.fasterxml.jackson.databind.node.ObjectNode readArrayObjectEntry(com.fasterxml.jackson.databind.node.ArrayNode json, int index) -
checkedToString
-
readString
-
readNullableString
-
readStringWithDefault
-
checkedToChar
-
readChar
-
readNullableChar
-
readCharWithDefault
public static char readCharWithDefault(com.fasterxml.jackson.databind.node.ObjectNode json, String key, char defaultValue) -
checkedToNumber
public static com.fasterxml.jackson.databind.JsonNode checkedToNumber(com.fasterxml.jackson.databind.JsonNode value, String key) -
readNumber
public static com.fasterxml.jackson.databind.JsonNode readNumber(com.fasterxml.jackson.databind.node.ObjectNode json, String key) -
readNullableNumber
@Nullable public static com.fasterxml.jackson.databind.JsonNode readNullableNumber(com.fasterxml.jackson.databind.node.ObjectNode json, String key) -
checkedToInt
-
readInt
-
readNullableInt
-
readIntWithDefault
public static int readIntWithDefault(com.fasterxml.jackson.databind.node.ObjectNode json, String key, int defaultValue) -
checkedToLong
-
readLong
-
readNullableLong
-
readLongWithDefault
public static long readLongWithDefault(com.fasterxml.jackson.databind.node.ObjectNode json, String key, long defaultValue) -
checkedToFloat
-
readFloat
-
readNullableFloat
-
readFloatWithDefault
public static float readFloatWithDefault(com.fasterxml.jackson.databind.node.ObjectNode json, String key, float defaultValue) -
checkedToDouble
-
readDouble
-
readNullableDouble
-
readDoubleWithDefault
public static double readDoubleWithDefault(com.fasterxml.jackson.databind.node.ObjectNode json, String key, double defaultValue) -
checkedToBool
-
readBool
-
readNullableBool
-
readBoolWithDefault
public static boolean readBoolWithDefault(com.fasterxml.jackson.databind.node.ObjectNode json, String key, boolean defaultValue) -
parseDate
-
encodeDate
-
encodeNullableDate
-
readDate
Reads an ISO date string. -
readNullableDate
@Nullable public static Instant readNullableDate(com.fasterxml.jackson.databind.node.ObjectNode json, String key) Reads an ISO date string. -
readDateWithDefault
public static Instant readDateWithDefault(com.fasterxml.jackson.databind.node.ObjectNode json, String key, Instant defaultValue) Reads an ISO date string.
-