Package org.apache.johnzon.jsonb
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 Summary
Fields Modifier and Type Field Description private Mapper
delegate
private boolean
ijson
private Consumer<JohnzonJsonb>
onClose
private Map<Class<?>,Boolean>
structureAwareIo
-
Constructor Summary
Constructors Constructor Description JohnzonJsonb(Mapper build, boolean ijson, Consumer<JohnzonJsonb> onClose)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
<T> T
fromJson(jakarta.json.stream.JsonParser json, Class<T> type)
<T> T
fromJson(jakarta.json.stream.JsonParser parser, Type runtimeType)
<T> T
fromJson(InputStream stream, Class<T> type)
<T> T
fromJson(InputStream stream, Type runtimeType)
<T> T
fromJson(Reader reader, Class<T> type)
<T> T
fromJson(Reader reader, Type runtimeType)
<T> T
fromJson(String str, Class<T> type)
<T> T
fromJson(String str, Type runtimeType)
<T> T
fromJsonValue(jakarta.json.JsonValue json, Class<T> type)
<T> T
fromJsonValue(jakarta.json.JsonValue json, Type type)
private boolean
isArray(Type runtimeType)
private boolean
isCollection(Type runtimeType)
private boolean
isNotObjectOrArray(Object object)
private boolean
isValueConsumer(Writer writer)
private boolean
isValueProvider(Reader reader)
private boolean
matchesType(Class<?> type, Class<?> rawType)
private Object[]
toArray(Object object)
private ParameterizedType
toCollectionType(Type runtimeType)
String
toJson(Object inObject)
void
toJson(Object object, jakarta.json.stream.JsonGenerator jsonGenerator)
void
toJson(Object inObject, OutputStream stream)
void
toJson(Object inObject, Writer writer)
String
toJson(Object inObject, Type runtimeType)
void
toJson(Object object, Type runtimeType, jakarta.json.stream.JsonGenerator jsonGenerator)
void
toJson(Object inObject, Type runtimeType, OutputStream stream)
void
toJson(Object inObject, Type runtimeType, Writer writer)
jakarta.json.JsonValue
toJsonValue(Object object)
jakarta.json.JsonValue
toJsonValue(Object rawObject, Type runtimeType)
private Object
unwrapOptional(Object inObject)
private Type
unwrapPrimitiveOptional(Type type)
private <T> T
wrapPrimitiveOptional(Object object, Type type)
-
-
-
Constructor Detail
-
JohnzonJsonb
public JohnzonJsonb(Mapper build, boolean ijson, Consumer<JohnzonJsonb> onClose)
-
-
Method Detail
-
fromJson
public <T> T fromJson(String str, Class<T> type) throws jakarta.json.bind.JsonbException
- Specified by:
fromJson
in interfacejakarta.json.bind.Jsonb
- Throws:
jakarta.json.bind.JsonbException
-
fromJson
public <T> T fromJson(String str, Type runtimeType) throws jakarta.json.bind.JsonbException
- Specified by:
fromJson
in interfacejakarta.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 interfacejakarta.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 interfacejakarta.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 interfacejakarta.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 interfacejakarta.json.bind.Jsonb
- Throws:
jakarta.json.bind.JsonbException
-
toJson
public String toJson(Object inObject) throws jakarta.json.bind.JsonbException
- Specified by:
toJson
in interfacejakarta.json.bind.Jsonb
- Throws:
jakarta.json.bind.JsonbException
-
toJson
public String toJson(Object inObject, Type runtimeType) throws jakarta.json.bind.JsonbException
- Specified by:
toJson
in interfacejakarta.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 interfacejakarta.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 interfacejakarta.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 interfacejakarta.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 interfacejakarta.json.bind.Jsonb
- Throws:
jakarta.json.bind.JsonbException
-
isNotObjectOrArray
private boolean isNotObjectOrArray(Object object)
-
isArray
private boolean isArray(Type runtimeType)
-
isCollection
private boolean isCollection(Type runtimeType)
-
close
public void close()
- Specified by:
close
in interfaceAutoCloseable
-
fromJsonValue
public <T> T fromJsonValue(jakarta.json.JsonValue json, Class<T> type)
- Specified by:
fromJsonValue
in interfaceJsonbExtension
-
toJsonValue
public jakarta.json.JsonValue toJsonValue(Object object)
- Specified by:
toJsonValue
in interfaceJsonbExtension
-
fromJsonValue
public <T> T fromJsonValue(jakarta.json.JsonValue json, Type type)
- Specified by:
fromJsonValue
in interfaceJsonbExtension
-
toJsonValue
public jakarta.json.JsonValue toJsonValue(Object rawObject, Type runtimeType)
- Specified by:
toJsonValue
in interfaceJsonbExtension
-
fromJson
public <T> T fromJson(jakarta.json.stream.JsonParser json, Class<T> type)
- Specified by:
fromJson
in interfaceJsonbExtension
-
fromJson
public <T> T fromJson(jakarta.json.stream.JsonParser parser, Type runtimeType)
- Specified by:
fromJson
in interfaceJsonbExtension
-
toJson
public void toJson(Object object, jakarta.json.stream.JsonGenerator jsonGenerator)
- Specified by:
toJson
in interfaceJsonbExtension
-
toJson
public void toJson(Object object, Type runtimeType, jakarta.json.stream.JsonGenerator jsonGenerator)
- Specified by:
toJson
in interfaceJsonbExtension
-
isValueProvider
private boolean isValueProvider(Reader reader)
-
isValueConsumer
private boolean isValueConsumer(Writer writer)
-
toCollectionType
private ParameterizedType toCollectionType(Type runtimeType)
-
-