Package org.hibernate.type.format
Interface JsonDocumentWriter
- All Known Implementing Classes:
OsonDocumentWriter,StringJsonDocumentWriter
public interface JsonDocumentWriter
JSON document producer.
Implementation of this inteface will used to build a JSON document.
Implementation example is
StringJsonDocumentWriter-
Method Summary
Modifier and TypeMethodDescriptionbooleanValue(boolean value) Adds a new JSON element boolean value.endArray()Ends a new JSON array.Ends a new JSON ObjectsAdds a new JSON element null value.numericValue(Number value) Adds a new JSON element numeric value.Adds a new JSON element name.serializeJsonValue(Object value, JavaType<T> javaType, JdbcType jdbcType, WrapperOptions options) Adds a JSON value to the documentStarts a new JSON array.Starts a new JSON Objects.stringValue(String value) Adds a new JSON element string value.
-
Method Details
-
startObject
JsonDocumentWriter startObject()Starts a new JSON Objects.- Returns:
- this instance
-
endObject
JsonDocumentWriter endObject()Ends a new JSON Objects- Returns:
- this instance
-
startArray
JsonDocumentWriter startArray()Starts a new JSON array.- Returns:
- this instance
- Throws:
IOException- an I/O error roccured while starting the object.
-
endArray
JsonDocumentWriter endArray()Ends a new JSON array.- Returns:
- this instance
- Throws:
IOException- an I/O error roccured while starting the object.
-
objectKey
Adds a new JSON element name.- Parameters:
key- the element name.- Returns:
- this instance
- Throws:
IllegalArgumentException- key name does not follow JSON specification.IOException- an I/O error occurred while starting the object.
-
nullValue
JsonDocumentWriter nullValue()Adds a new JSON element null value.- Returns:
- this instance
- Throws:
IOException- an I/O error roccured while starting the object.
-
numericValue
Adds a new JSON element numeric value.- Parameters:
value- the element numeric name.- Returns:
- this instance
-
booleanValue
Adds a new JSON element boolean value.- Parameters:
value- the element boolean name.- Returns:
- this instance
-
stringValue
Adds a new JSON element string value.- Parameters:
value- the element string name.- Returns:
- this instance
-
serializeJsonValue
<T> JsonDocumentWriter serializeJsonValue(Object value, JavaType<T> javaType, JdbcType jdbcType, WrapperOptions options) Adds a JSON value to the document- Parameters:
value- the value to be serializedjavaType- the Java type of the valuejdbcType- the JDBC type for the value to be serializedoptions- the wrapping options- Returns:
- this instance
-