Class JsonHelper

java.lang.Object
net.royalur.notation.JsonHelper

public class JsonHelper extends Object
Contains type checking helper methods for retrieving JSON values, as Jackson doesn't support that for some reason.
  • Field Details

    • MAX_FLOAT_READ_EPSILON

      public static final double MAX_FLOAT_READ_EPSILON
      See Also:
    • MAX_DOUBLE_READ_EPSILON

      public static final BigDecimal 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

      public static String checkedToString(com.fasterxml.jackson.databind.JsonNode value, String key)
    • readString

      public static String readString(com.fasterxml.jackson.databind.node.ObjectNode json, String key)
    • readNullableString

      @Nullable public static String readNullableString(com.fasterxml.jackson.databind.node.ObjectNode json, String key)
    • readStringWithDefault

      public static String readStringWithDefault(com.fasterxml.jackson.databind.node.ObjectNode json, String key, String defaultValue)
    • checkedToChar

      public static char checkedToChar(String value, String key)
    • readChar

      public static char readChar(com.fasterxml.jackson.databind.node.ObjectNode json, String key)
    • readNullableChar

      @Nullable public static Character readNullableChar(com.fasterxml.jackson.databind.node.ObjectNode json, String key)
    • 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

      public static int checkedToInt(com.fasterxml.jackson.databind.JsonNode value, String key)
    • readInt

      public static int readInt(com.fasterxml.jackson.databind.node.ObjectNode json, String key)
    • readNullableInt

      @Nullable public static Integer readNullableInt(com.fasterxml.jackson.databind.node.ObjectNode json, String key)
    • readIntWithDefault

      public static int readIntWithDefault(com.fasterxml.jackson.databind.node.ObjectNode json, String key, int defaultValue)
    • checkedToLong

      public static long checkedToLong(com.fasterxml.jackson.databind.JsonNode value, String key)
    • readLong

      public static long readLong(com.fasterxml.jackson.databind.node.ObjectNode json, String key)
    • readNullableLong

      @Nullable public static Long readNullableLong(com.fasterxml.jackson.databind.node.ObjectNode json, String key)
    • readLongWithDefault

      public static long readLongWithDefault(com.fasterxml.jackson.databind.node.ObjectNode json, String key, long defaultValue)
    • checkedToFloat

      public static float checkedToFloat(com.fasterxml.jackson.databind.JsonNode value, String key)
    • readFloat

      public static float readFloat(com.fasterxml.jackson.databind.node.ObjectNode json, String key)
    • readNullableFloat

      @Nullable public static Float readNullableFloat(com.fasterxml.jackson.databind.node.ObjectNode json, String key)
    • readFloatWithDefault

      public static float readFloatWithDefault(com.fasterxml.jackson.databind.node.ObjectNode json, String key, float defaultValue)
    • checkedToDouble

      public static double checkedToDouble(com.fasterxml.jackson.databind.JsonNode value, String key)
    • readDouble

      public static double readDouble(com.fasterxml.jackson.databind.node.ObjectNode json, String key)
    • readNullableDouble

      @Nullable public static Double readNullableDouble(com.fasterxml.jackson.databind.node.ObjectNode json, String key)
    • readDoubleWithDefault

      public static double readDoubleWithDefault(com.fasterxml.jackson.databind.node.ObjectNode json, String key, double defaultValue)
    • checkedToBool

      public static boolean checkedToBool(com.fasterxml.jackson.databind.JsonNode value, String key)
    • readBool

      public static boolean readBool(com.fasterxml.jackson.databind.node.ObjectNode json, String key)
    • readNullableBool

      @Nullable public static Boolean readNullableBool(com.fasterxml.jackson.databind.node.ObjectNode json, String key)
    • readBoolWithDefault

      public static boolean readBoolWithDefault(com.fasterxml.jackson.databind.node.ObjectNode json, String key, boolean defaultValue)
    • parseDate

      public static Instant parseDate(String value)
    • encodeDate

      public static String encodeDate(Instant instant)
    • encodeNullableDate

      @Nullable public static String encodeNullableDate(@Nullable Instant instant)
    • readDate

      public static Instant readDate(com.fasterxml.jackson.databind.node.ObjectNode json, String key)
      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.