Class RawJsonValue

java.lang.Object
org.keycloak.json.RawJsonValue
All Implemented Interfaces:
Serializable

public final class RawJsonValue extends Object implements Serializable
A Jackson-version-agnostic replacement for JsonNode.

Jackson 2 uses com.fasterxml.jackson.databind.JsonNode, Jackson 3 uses tools.jackson.databind.JsonNode — different classes in different packages. This type wraps an arbitrary JSON value and delegates all navigation to a RawJsonValueSupport implementation backed by the real JsonNode from whichever Jackson version is on the classpath.

Self-describing to any Jackson version via shared annotations (JsonCreator and JsonValue from com.fasterxml.jackson.annotation).

See Also:
  • Method Details

    • of

      public static RawJsonValue of(Object value)
    • getValue

      public Object getValue()
    • get

      public RawJsonValue get(String key)
    • path

      public RawJsonValue path(String key)
    • asBoolean

      public boolean asBoolean()
    • asInt

      public int asInt()
    • asLong

      public long asLong()
    • asText

      public String asText()
    • asText

      public String asText(String defaultValue)
    • textValue

      public String textValue()
    • isEmpty

      public boolean isEmpty()
    • unwrap

      public static <T> T unwrap(Class<T> type, RawJsonValue rawJsonValue)
      Converts the underlying value to the given type using the KeycloakJsonMapper. Useful for server-side code that needs a Jackson-version-specific type (e.g., JsonNode).
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object