Package org.eclipse.yasson.internal
Class JsonBinding
- java.lang.Object
-
- org.eclipse.yasson.internal.JsonBinding
-
- All Implemented Interfaces:
java.lang.AutoCloseable,javax.json.bind.Jsonb,YassonJsonb
public class JsonBinding extends java.lang.Object implements YassonJsonb
Implementation of Jsonb interface.
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()protected java.util.Map<java.lang.String,?>createJsonpProperties(javax.json.bind.JsonbConfig jsonbConfig)Propagates properties from JsonbConfig to JSONP generator / parser factories.<T> TfromJson(java.io.InputStream stream, java.lang.Class<T> clazz)<T> TfromJson(java.io.InputStream stream, java.lang.reflect.Type type)<T> TfromJson(java.io.Reader reader, java.lang.Class<T> type)<T> TfromJson(java.io.Reader reader, java.lang.reflect.Type type)<T> TfromJson(java.lang.String str, java.lang.Class<T> type)<T> TfromJson(java.lang.String str, java.lang.reflect.Type type)<T> TfromJson(javax.json.stream.JsonParser jsonParser, java.lang.Class<T> type)Reads in a JSON data with a specifiedJsonParserand return the resulting content tree.<T> TfromJson(javax.json.stream.JsonParser jsonParser, java.lang.reflect.Type runtimeType)Reads in a JSON data with a specifiedJsonParserand return the resulting content tree.<T> TfromJsonStructure(javax.json.JsonStructure jsonStructure, java.lang.Class<T> type)Reads aJsonStructureand and converts it into resulting java content tree.<T> TfromJsonStructure(javax.json.JsonStructure jsonStructure, java.lang.reflect.Type runtimeType)Reads aJsonStructureand and converts it into resulting java content tree.java.lang.StringtoJson(java.lang.Object object)voidtoJson(java.lang.Object object, java.io.OutputStream stream)voidtoJson(java.lang.Object object, java.io.Writer writer)java.lang.StringtoJson(java.lang.Object object, java.lang.reflect.Type type)voidtoJson(java.lang.Object object, java.lang.reflect.Type type, java.io.OutputStream stream)voidtoJson(java.lang.Object object, java.lang.reflect.Type type, java.io.Writer writer)voidtoJson(java.lang.Object object, java.lang.reflect.Type runtimeType, javax.json.stream.JsonGenerator jsonGenerator)Writes the object content tree with a specifiedJsonGenerator.voidtoJson(java.lang.Object object, javax.json.stream.JsonGenerator jsonGenerator)Writes the object content tree with a specifiedJsonGenerator.javax.json.JsonStructuretoJsonStructure(java.lang.Object object)Serializes the object content tree to aJsonStructure.javax.json.JsonStructuretoJsonStructure(java.lang.Object object, java.lang.reflect.Type runtimeType)Serializes the object content tree to aJsonStructure.
-
-
-
Method Detail
-
fromJson
public <T> T fromJson(java.lang.String str, java.lang.Class<T> type) throws javax.json.bind.JsonbException- Specified by:
fromJsonin interfacejavax.json.bind.Jsonb- Throws:
javax.json.bind.JsonbException
-
fromJson
public <T> T fromJson(java.lang.String str, java.lang.reflect.Type type) throws javax.json.bind.JsonbException- Specified by:
fromJsonin interfacejavax.json.bind.Jsonb- Throws:
javax.json.bind.JsonbException
-
fromJson
public <T> T fromJson(java.io.Reader reader, java.lang.Class<T> type) throws javax.json.bind.JsonbException- Specified by:
fromJsonin interfacejavax.json.bind.Jsonb- Throws:
javax.json.bind.JsonbException
-
fromJson
public <T> T fromJson(java.io.Reader reader, java.lang.reflect.Type type) throws javax.json.bind.JsonbException- Specified by:
fromJsonin interfacejavax.json.bind.Jsonb- Throws:
javax.json.bind.JsonbException
-
fromJson
public <T> T fromJson(java.io.InputStream stream, java.lang.Class<T> clazz) throws javax.json.bind.JsonbException- Specified by:
fromJsonin interfacejavax.json.bind.Jsonb- Throws:
javax.json.bind.JsonbException
-
fromJson
public <T> T fromJson(java.io.InputStream stream, java.lang.reflect.Type type) throws javax.json.bind.JsonbException- Specified by:
fromJsonin interfacejavax.json.bind.Jsonb- Throws:
javax.json.bind.JsonbException
-
fromJsonStructure
public <T> T fromJsonStructure(javax.json.JsonStructure jsonStructure, java.lang.Class<T> type) throws javax.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:
javax.json.bind.JsonbException- If any unexpected error(s) occur(s) during conversion.
-
fromJsonStructure
public <T> T fromJsonStructure(javax.json.JsonStructure jsonStructure, java.lang.reflect.Type runtimeType) throws javax.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:
javax.json.bind.JsonbException- If any unexpected error(s) occur(s) during deserialization.
-
toJson
public java.lang.String toJson(java.lang.Object object) throws javax.json.bind.JsonbException- Specified by:
toJsonin interfacejavax.json.bind.Jsonb- Throws:
javax.json.bind.JsonbException
-
toJson
public java.lang.String toJson(java.lang.Object object, java.lang.reflect.Type type) throws javax.json.bind.JsonbException- Specified by:
toJsonin interfacejavax.json.bind.Jsonb- Throws:
javax.json.bind.JsonbException
-
toJson
public void toJson(java.lang.Object object, java.io.Writer writer) throws javax.json.bind.JsonbException- Specified by:
toJsonin interfacejavax.json.bind.Jsonb- Throws:
javax.json.bind.JsonbException
-
toJson
public void toJson(java.lang.Object object, java.lang.reflect.Type type, java.io.Writer writer) throws javax.json.bind.JsonbException- Specified by:
toJsonin interfacejavax.json.bind.Jsonb- Throws:
javax.json.bind.JsonbException
-
toJson
public void toJson(java.lang.Object object, java.io.OutputStream stream) throws javax.json.bind.JsonbException- Specified by:
toJsonin interfacejavax.json.bind.Jsonb- Throws:
javax.json.bind.JsonbException
-
toJson
public void toJson(java.lang.Object object, java.lang.reflect.Type type, java.io.OutputStream stream) throws javax.json.bind.JsonbException- Specified by:
toJsonin interfacejavax.json.bind.Jsonb- Throws:
javax.json.bind.JsonbException
-
fromJson
public <T> T fromJson(javax.json.stream.JsonParser jsonParser, java.lang.Class<T> type) throws javax.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:
javax.json.bind.JsonbException- If any unexpected error(s) occur(s) during deserialization.
-
fromJson
public <T> T fromJson(javax.json.stream.JsonParser jsonParser, java.lang.reflect.Type runtimeType) throws javax.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:
javax.json.bind.JsonbException- If any unexpected error(s) occur(s) during deserialization.
-
toJson
public void toJson(java.lang.Object object, javax.json.stream.JsonGenerator jsonGenerator) throws javax.json.bind.JsonbExceptionDescription 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:
javax.json.bind.JsonbException- If any unexpected problem occurs during the serialization.
-
toJson
public void toJson(java.lang.Object object, java.lang.reflect.Type runtimeType, javax.json.stream.JsonGenerator jsonGenerator) throws javax.json.bind.JsonbExceptionDescription 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:
javax.json.bind.JsonbException- If any unexpected problem occurs during the serialization.
-
toJsonStructure
public javax.json.JsonStructure toJsonStructure(java.lang.Object object) throws javax.json.bind.JsonbExceptionDescription 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:
javax.json.bind.JsonbException- If any unexpected problem occurs during the serialization.
-
toJsonStructure
public javax.json.JsonStructure toJsonStructure(java.lang.Object object, java.lang.reflect.Type runtimeType) throws javax.json.bind.JsonbExceptionDescription 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:
javax.json.bind.JsonbException- If any unexpected problem occurs during the serialization.
-
close
public void close() throws java.lang.Exception- Specified by:
closein interfacejava.lang.AutoCloseable- Throws:
java.lang.Exception
-
createJsonpProperties
protected java.util.Map<java.lang.String,?> createJsonpProperties(javax.json.bind.JsonbConfig jsonbConfig)
Propagates properties from JsonbConfig to JSONP generator / parser factories.- Parameters:
jsonbConfig- jsonb config- Returns:
- properties for JSONP generator / parser
-
-