Class JohnzonJsonb

java.lang.Object
org.apache.johnzon.jsonb.JohnzonJsonb
All Implemented Interfaces:
jakarta.json.bind.Jsonb, AutoCloseable, JsonbExtension

public class JohnzonJsonb extends Object implements jakarta.json.bind.Jsonb, AutoCloseable, JsonbExtension
  • Field Details

    • delegate

      private final org.apache.johnzon.mapper.Mapper delegate
    • ijson

      private final boolean ijson
    • onClose

      private final Consumer<JohnzonJsonb> onClose
    • structureAwareIo

      private final Map<Class<?>,Boolean> structureAwareIo
  • Constructor Details

    • JohnzonJsonb

      public JohnzonJsonb(org.apache.johnzon.mapper.Mapper build, boolean ijson, Consumer<JohnzonJsonb> onClose)
  • Method Details

    • fromJson

      public <T> T fromJson(String str, Class<T> type) throws jakarta.json.bind.JsonbException
      Specified by:
      fromJson in interface jakarta.json.bind.Jsonb
      Throws:
      jakarta.json.bind.JsonbException
    • wrapPrimitiveOptional

      private <T> T wrapPrimitiveOptional(Object object, Type type)
    • unwrapPrimitiveOptional

      private Type unwrapPrimitiveOptional(Type type)
    • fromJson

      public <T> T fromJson(String str, Type runtimeType) throws jakarta.json.bind.JsonbException
      Specified by:
      fromJson in interface jakarta.json.bind.Jsonb
      Throws:
      jakarta.json.bind.JsonbException
    • fromJson

      public <T> T fromJson(Reader reader, Class<T> type) throws jakarta.json.bind.JsonbException
      Specified by:
      fromJson in interface jakarta.json.bind.Jsonb
      Throws:
      jakarta.json.bind.JsonbException
    • fromJson

      public <T> T fromJson(Reader reader, Type runtimeType) throws jakarta.json.bind.JsonbException
      Specified by:
      fromJson in interface jakarta.json.bind.Jsonb
      Throws:
      jakarta.json.bind.JsonbException
    • fromJson

      public <T> T fromJson(InputStream stream, Class<T> type) throws jakarta.json.bind.JsonbException
      Specified by:
      fromJson in interface jakarta.json.bind.Jsonb
      Throws:
      jakarta.json.bind.JsonbException
    • fromJson

      public <T> T fromJson(InputStream stream, Type runtimeType) throws jakarta.json.bind.JsonbException
      Specified by:
      fromJson in interface jakarta.json.bind.Jsonb
      Throws:
      jakarta.json.bind.JsonbException
    • toJson

      public String toJson(Object inObject) throws jakarta.json.bind.JsonbException
      Specified by:
      toJson in interface jakarta.json.bind.Jsonb
      Throws:
      jakarta.json.bind.JsonbException
    • toArray

      private Object[] toArray(Object object)
    • toJson

      public String toJson(Object inObject, Type runtimeType) throws jakarta.json.bind.JsonbException
      Specified by:
      toJson in interface jakarta.json.bind.Jsonb
      Throws:
      jakarta.json.bind.JsonbException
    • toJson

      public void toJson(Object inObject, Writer writer) throws jakarta.json.bind.JsonbException
      Specified by:
      toJson in interface jakarta.json.bind.Jsonb
      Throws:
      jakarta.json.bind.JsonbException
    • toJson

      public void toJson(Object inObject, Type runtimeType, Writer writer) throws jakarta.json.bind.JsonbException
      Specified by:
      toJson in interface jakarta.json.bind.Jsonb
      Throws:
      jakarta.json.bind.JsonbException
    • toJson

      public void toJson(Object inObject, OutputStream stream) throws jakarta.json.bind.JsonbException
      Specified by:
      toJson in interface jakarta.json.bind.Jsonb
      Throws:
      jakarta.json.bind.JsonbException
    • toJson

      public void toJson(Object inObject, Type runtimeType, OutputStream stream) throws jakarta.json.bind.JsonbException
      Specified by:
      toJson in interface jakarta.json.bind.Jsonb
      Throws:
      jakarta.json.bind.JsonbException
    • isNotObjectOrArray

      private boolean isNotObjectOrArray(Object object)
    • unwrapOptional

      private Object unwrapOptional(Object inObject)
    • isArray

      private boolean isArray(Type runtimeType)
    • isCollection

      private boolean isCollection(Type runtimeType)
    • close

      public void close()
      Specified by:
      close in interface AutoCloseable
    • fromJsonValue

      public <T> T fromJsonValue(jakarta.json.JsonValue json, Class<T> type)
      Specified by:
      fromJsonValue in interface JsonbExtension
    • toJsonValue

      public jakarta.json.JsonValue toJsonValue(Object object)
      Specified by:
      toJsonValue in interface JsonbExtension
    • fromJsonValue

      public <T> T fromJsonValue(jakarta.json.JsonValue json, Type type)
      Specified by:
      fromJsonValue in interface JsonbExtension
    • toJsonValue

      public jakarta.json.JsonValue toJsonValue(Object rawObject, Type runtimeType)
      Specified by:
      toJsonValue in interface JsonbExtension
    • fromJson

      public <T> T fromJson(jakarta.json.stream.JsonParser json, Class<T> type)
      Specified by:
      fromJson in interface JsonbExtension
    • fromJson

      public <T> T fromJson(jakarta.json.stream.JsonParser parser, Type runtimeType)
      Specified by:
      fromJson in interface JsonbExtension
    • toJson

      public void toJson(Object object, jakarta.json.stream.JsonGenerator jsonGenerator)
      Specified by:
      toJson in interface JsonbExtension
    • toJson

      public void toJson(Object object, Type runtimeType, jakarta.json.stream.JsonGenerator jsonGenerator)
      Specified by:
      toJson in interface JsonbExtension
    • isValueProvider

      private boolean isValueProvider(Reader reader)
    • isValueConsumer

      private boolean isValueConsumer(Writer writer)
    • matchesType

      private boolean matchesType(Class<?> type, Class<?> rawType)
    • toCollectionType

      private ParameterizedType toCollectionType(Type runtimeType)