- java.lang.Object
-
- org.eclipse.yasson.internal.JsonBinding
-
- All Implemented Interfaces:
jakarta.json.bind.Jsonb,AutoCloseable,YassonJsonb
public class JsonBinding extends Object implements YassonJsonb
Implementation of Jsonb interface.
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()protected Map<String,?>createJsonpProperties(jakarta.json.bind.JsonbConfig jsonbConfig)Propagates properties from JsonbConfig to JSONP generator / parser factories.<T> TfromJson(jakarta.json.stream.JsonParser jsonParser, Class<T> type)Reads in a JSON data with a specifiedJsonParserand return the resulting content tree.<T> TfromJson(jakarta.json.stream.JsonParser jsonParser, Type runtimeType)Reads in a JSON data with a specifiedJsonParserand return the resulting content tree.<T> TfromJson(InputStream stream, Class<T> clazz)<T> TfromJson(InputStream stream, Type type)<T> TfromJson(Reader reader, Class<T> type)<T> TfromJson(Reader reader, Type type)<T> TfromJson(String str, Class<T> type)<T> TfromJson(String str, Type type)<T> TfromJsonStructure(jakarta.json.JsonStructure jsonStructure, Class<T> type)Reads aJsonStructureand and converts it into resulting java content tree.<T> TfromJsonStructure(jakarta.json.JsonStructure jsonStructure, Type runtimeType)Reads aJsonStructureand and converts it into resulting java content tree.StringtoJson(Object object)voidtoJson(Object object, jakarta.json.stream.JsonGenerator jsonGenerator)Writes the object content tree with a specifiedJsonGenerator.voidtoJson(Object object, OutputStream stream)voidtoJson(Object object, Writer writer)StringtoJson(Object object, Type type)voidtoJson(Object object, Type runtimeType, jakarta.json.stream.JsonGenerator jsonGenerator)Writes the object content tree with a specifiedJsonGenerator.voidtoJson(Object object, Type type, OutputStream stream)voidtoJson(Object object, Type type, Writer writer)jakarta.json.JsonStructuretoJsonStructure(Object object)Serializes the object content tree to aJsonStructure.jakarta.json.JsonStructuretoJsonStructure(Object object, Type runtimeType)Serializes the object content tree to aJsonStructure.
-
-
-
Method Detail
-
fromJson
public <T> T fromJson(String str, Class<T> type) throws jakarta.json.bind.JsonbException
- Specified by:
fromJsonin interfacejakarta.json.bind.Jsonb- Throws:
jakarta.json.bind.JsonbException
-
fromJson
public <T> T fromJson(String str, Type type) throws jakarta.json.bind.JsonbException
- Specified by:
fromJsonin 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:
fromJsonin interfacejakarta.json.bind.Jsonb- Throws:
jakarta.json.bind.JsonbException
-
fromJson
public <T> T fromJson(Reader reader, Type type) throws jakarta.json.bind.JsonbException
- Specified by:
fromJsonin interfacejakarta.json.bind.Jsonb- Throws:
jakarta.json.bind.JsonbException
-
fromJson
public <T> T fromJson(InputStream stream, Class<T> clazz) throws jakarta.json.bind.JsonbException
- Specified by:
fromJsonin interfacejakarta.json.bind.Jsonb- Throws:
jakarta.json.bind.JsonbException
-
fromJson
public <T> T fromJson(InputStream stream, Type type) throws jakarta.json.bind.JsonbException
- Specified by:
fromJsonin interfacejakarta.json.bind.Jsonb- Throws:
jakarta.json.bind.JsonbException
-
fromJsonStructure
public <T> T fromJsonStructure(jakarta.json.JsonStructure jsonStructure, Class<T> type) throws jakarta.json.bind.JsonbExceptionDescription copied from interface:YassonJsonbReads aJsonStructureand and converts it into resulting java content tree.- Specified by:
fromJsonStructurein interfaceYassonJsonb- Type Parameters:
T- Type of the content tree's root object.- Parameters:
jsonStructure-JsonStructureto be used as a source for conversion.type- Type of the content tree's root object.- Returns:
- the newly created root object of the java content tree
- Throws:
jakarta.json.bind.JsonbException- If any unexpected error(s) occur(s) during conversion.
-
fromJsonStructure
public <T> T fromJsonStructure(jakarta.json.JsonStructure jsonStructure, Type runtimeType) throws jakarta.json.bind.JsonbExceptionDescription copied from interface:YassonJsonbReads aJsonStructureand and converts it into resulting java content tree.- Specified by:
fromJsonStructurein interfaceYassonJsonb- Type Parameters:
T- Type of the content tree's root object.- Parameters:
jsonStructure-JsonStructureto be used as a source for conversion.runtimeType- Runtime type of the content tree's root object.- Returns:
- the newly created root object of the java content tree
- Throws:
jakarta.json.bind.JsonbException- If any unexpected error(s) occur(s) during deserialization.
-
toJson
public String toJson(Object object) throws jakarta.json.bind.JsonbException
- Specified by:
toJsonin interfacejakarta.json.bind.Jsonb- Throws:
jakarta.json.bind.JsonbException
-
toJson
public String toJson(Object object, Type type) throws jakarta.json.bind.JsonbException
- Specified by:
toJsonin interfacejakarta.json.bind.Jsonb- Throws:
jakarta.json.bind.JsonbException
-
toJson
public void toJson(Object object, Writer writer) throws jakarta.json.bind.JsonbException
- Specified by:
toJsonin interfacejakarta.json.bind.Jsonb- Throws:
jakarta.json.bind.JsonbException
-
toJson
public void toJson(Object object, Type type, Writer writer) throws jakarta.json.bind.JsonbException
- Specified by:
toJsonin interfacejakarta.json.bind.Jsonb- Throws:
jakarta.json.bind.JsonbException
-
toJson
public void toJson(Object object, OutputStream stream) throws jakarta.json.bind.JsonbException
- Specified by:
toJsonin interfacejakarta.json.bind.Jsonb- Throws:
jakarta.json.bind.JsonbException
-
toJson
public void toJson(Object object, Type type, OutputStream stream) throws jakarta.json.bind.JsonbException
- Specified by:
toJsonin interfacejakarta.json.bind.Jsonb- Throws:
jakarta.json.bind.JsonbException
-
fromJson
public <T> T fromJson(jakarta.json.stream.JsonParser jsonParser, Class<T> type) throws jakarta.json.bind.JsonbExceptionDescription copied from interface:YassonJsonbReads in a JSON data with a specifiedJsonParserand return the resulting content tree. Provided json parser must be fully initialized, no further configurations will be applied.- Specified by:
fromJsonin interfaceYassonJsonb- Type Parameters:
T- Type of the content tree's root object.- Parameters:
jsonParser- The json parser instance to be used to read JSON data.type- Type of the content tree's root object.- Returns:
- the newly created root object of the java content tree
- Throws:
jakarta.json.bind.JsonbException- If any unexpected error(s) occur(s) during deserialization.
-
fromJson
public <T> T fromJson(jakarta.json.stream.JsonParser jsonParser, Type runtimeType) throws jakarta.json.bind.JsonbExceptionDescription copied from interface:YassonJsonbReads in a JSON data with a specifiedJsonParserand return the resulting content tree. Provided json parser must be fully initialized, no further configurations will be applied.- Specified by:
fromJsonin interfaceYassonJsonb- Type Parameters:
T- Type of the content tree's root object.- Parameters:
jsonParser- The json parser instance to be used to read JSON data.runtimeType- Runtime type of the content tree's root object.- Returns:
- the newly created root object of the java content tree
- Throws:
jakarta.json.bind.JsonbException- If any unexpected error(s) occur(s) during deserialization.
-
toJson
public void toJson(Object object, jakarta.json.stream.JsonGenerator jsonGenerator) throws jakarta.json.bind.JsonbException
Description copied from interface:YassonJsonbWrites the object content tree with a specifiedJsonGenerator. Provided json generator must be fully initialized, no further configurations are applied.- Specified by:
toJsonin interfaceYassonJsonb- Parameters:
object- The object content tree to be serialized.jsonGenerator- The json generator to write JSON data. The generator is not closed on a completion for further interaction.- Throws:
jakarta.json.bind.JsonbException- If any unexpected problem occurs during the serialization.
-
toJson
public void toJson(Object object, Type runtimeType, jakarta.json.stream.JsonGenerator jsonGenerator) throws jakarta.json.bind.JsonbException
Description copied from interface:YassonJsonbWrites the object content tree with a specifiedJsonGenerator. Provided json generator must be fully initialized, no further configurations are applied.- Specified by:
toJsonin interfaceYassonJsonb- Parameters:
object- The object content tree to be serialized.runtimeType- Runtime type of the content tree's root object.jsonGenerator- The json generator to write JSON data. The generator is not closed on a completion for further interaction.- Throws:
jakarta.json.bind.JsonbException- If any unexpected problem occurs during the serialization.
-
toJsonStructure
public jakarta.json.JsonStructure toJsonStructure(Object object) throws jakarta.json.bind.JsonbException
Description copied from interface:YassonJsonbSerializes the object content tree to aJsonStructure.- Specified by:
toJsonStructurein interfaceYassonJsonb- Parameters:
object- The object content tree to be serialized.- Returns:
- The
JsonStructureserialized from java content tree. - Throws:
jakarta.json.bind.JsonbException- If any unexpected problem occurs during the serialization.
-
toJsonStructure
public jakarta.json.JsonStructure toJsonStructure(Object object, Type runtimeType) throws jakarta.json.bind.JsonbException
Description copied from interface:YassonJsonbSerializes the object content tree to aJsonStructure.- Specified by:
toJsonStructurein interfaceYassonJsonb- Parameters:
object- The object content tree to be serialized.runtimeType- Runtime type of the content tree's root object.- Returns:
- The
JsonStructureserialized from java content tree. - Throws:
jakarta.json.bind.JsonbException- If any unexpected problem occurs during the serialization.
-
close
public void close() throws Exception- Specified by:
closein interfaceAutoCloseable- Throws:
Exception
-
-