SerializerBuildHelper¶
Creating Serializer (Expression) for Object¶
createSerializerForObject(
inputObject: Expression,
fields: Seq[(String, Expression)]): Expression
createSerializerForObject
creates a CreateNamedStruct expression with argumentsForFieldSerializer for the given fields
.
Only when the given Expression is nullable, createSerializerForObject
wraps the CreateNamedStruct
expression with an If
expression with IsNull
child expression, a null
Literal and the CreateNamedStruct
expressions (for the positive and negative branches of the If
expression, respectively).
createSerializerForObject
is used when:
JavaTypeInference
utility is used toserializerFor
ScalaReflection
utility is used to create a serializer (for ScalaProduct
s orDefinedByConstructorParams
s)
argumentsForFieldSerializer¶
argumentsForFieldSerializer(
fieldName: String,
serializerForFieldValue: Expression): Seq[Expression]
argumentsForFieldSerializer
creates a two-element collection of the following:
- Literal for the given
fieldName
serializerForFieldValue
Expression