Class JsonGeneratingVisitor
java.lang.Object
org.hibernate.type.descriptor.jdbc.spi.JsonGeneratingVisitor
- Direct Known Subclasses:
DescriptiveJsonGeneratingVisitor
Stateless helper class to serialize managed type values to JSON.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected booleanhandleNullOrLazy(Object value, JsonDocumentWriter writer) Checks the providedvalueis either null or a lazy property.protected voidserializeEntity(Object value, EntityMappingType entityType, WrapperOptions options, JsonDocumentWriter writer) protected voidserializeEntityIdentifier(Object value, EntityIdentifierMapping identifierMapping, WrapperOptions options, JsonDocumentWriter writer) protected voidserializeModelPart(ValuedModelPart modelPart, Object value, WrapperOptions options, JsonDocumentWriter writer) protected voidserializeObjectValues(ManagedMappingType managedMappingType, Object object, WrapperOptions options, JsonDocumentWriter writer) JSON object managed type serialization.voidvisit(MappingType mappedType, Object value, WrapperOptions options, JsonDocumentWriter writer) voidvisitArray(JavaType<?> elementJavaType, JdbcType elementJdbcType, Object[] values, WrapperOptions options, JsonDocumentWriter writer) Serializes an array of values into JSON object/array
-
Field Details
-
INSTANCE
-
-
Constructor Details
-
JsonGeneratingVisitor
protected JsonGeneratingVisitor()
-
-
Method Details
-
visitArray
public void visitArray(JavaType<?> elementJavaType, JdbcType elementJdbcType, Object[] values, WrapperOptions options, JsonDocumentWriter writer) Serializes an array of values into JSON object/array- Parameters:
elementJavaType- the array element typeelementJdbcType- the JDBC typevalues- values to be serializedoptions- wrapping optionswriter- the document writer used for serialization
-
visit
public void visit(MappingType mappedType, Object value, WrapperOptions options, JsonDocumentWriter writer) throws IOException - Throws:
IOException
-
handleNullOrLazy
Checks the providedvalueis either null or a lazy property.- Parameters:
value- the value to checkwriter- the currentJsonDocumentWriter- Returns:
trueif it was, indicating no further processing of the value is needed,false otherwise.
-
serializeObjectValues
protected void serializeObjectValues(ManagedMappingType managedMappingType, Object object, WrapperOptions options, JsonDocumentWriter writer) throws IOException JSON object managed type serialization.- Parameters:
managedMappingType- the managed mapping type of the given objectobject- the object to be serializedoptions- wrapping optionswriter- the document writer- Throws:
IOException- if an error occurred while writing to an underlying writer- See Also:
-
serializeModelPart
protected void serializeModelPart(ValuedModelPart modelPart, Object value, WrapperOptions options, JsonDocumentWriter writer) throws IOException - Throws:
IOException
-
serializeEntity
protected void serializeEntity(Object value, EntityMappingType entityType, WrapperOptions options, JsonDocumentWriter writer) throws IOException - Throws:
IOException
-
serializeEntityIdentifier
protected void serializeEntityIdentifier(Object value, EntityIdentifierMapping identifierMapping, WrapperOptions options, JsonDocumentWriter writer) throws IOException - Throws:
IOException
-