-
- All Superinterfaces:
AutoCloseable,jakarta.json.bind.Jsonb
- All Known Implementing Classes:
JsonBinding
public interface YassonJsonb extends jakarta.json.bind.JsonbAdds methods to Jsonb that are operating directly withJsonGeneratororJsonParsertypes.JsonProvideroperates on top of theInputStream/OutputStreamorReader/Writerand creates generator / parser instances during runtime.This interface accepts instantiated generators and parsers with different input / output sources.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description <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> 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.voidtoJson(Object object, jakarta.json.stream.JsonGenerator jsonGenerator)Writes the object content tree with a specifiedJsonGenerator.voidtoJson(Object object, Type runtimeType, jakarta.json.stream.JsonGenerator jsonGenerator)Writes the object content tree with a specifiedJsonGenerator.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.-
Methods inherited from interface java.lang.AutoCloseable
close
-
-
-
-
Method Detail
-
fromJson
<T> T fromJson(jakarta.json.stream.JsonParser jsonParser, Class<T> type) throws jakarta.json.bind.JsonbExceptionReads 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.- 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
<T> T fromJson(jakarta.json.stream.JsonParser jsonParser, Type runtimeType) throws jakarta.json.bind.JsonbExceptionReads 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.- 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.
-
fromJsonStructure
<T> T fromJsonStructure(jakarta.json.JsonStructure jsonStructure, Class<T> type) throws jakarta.json.bind.JsonbExceptionReads aJsonStructureand and converts it into resulting java content tree.- 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
<T> T fromJsonStructure(jakarta.json.JsonStructure jsonStructure, Type runtimeType) throws jakarta.json.bind.JsonbExceptionReads aJsonStructureand and converts it into resulting java content tree.- 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
void toJson(Object object, jakarta.json.stream.JsonGenerator jsonGenerator) throws jakarta.json.bind.JsonbException
Writes the object content tree with a specifiedJsonGenerator. Provided json generator must be fully initialized, no further configurations are applied.- 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.- Since:
- JSON Binding 1.0
-
toJson
void toJson(Object object, Type runtimeType, jakarta.json.stream.JsonGenerator jsonGenerator) throws jakarta.json.bind.JsonbException
Writes the object content tree with a specifiedJsonGenerator. Provided json generator must be fully initialized, no further configurations are applied.- 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.- Since:
- JSON Binding 1.0
-
toJsonStructure
jakarta.json.JsonStructure toJsonStructure(Object object) throws jakarta.json.bind.JsonbException
Serializes the object content tree to aJsonStructure.- 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.- Since:
- JSON Binding 1.0
-
toJsonStructure
jakarta.json.JsonStructure toJsonStructure(Object object, Type runtimeType) throws jakarta.json.bind.JsonbException
Serializes the object content tree to aJsonStructure.- 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.- Since:
- JSON Binding 1.0
-
-