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:
JavaTypeInferenceutility is used toserializerForScalaReflectionutility is used to create a serializer (for ScalaProducts orDefinedByConstructorParamss)
argumentsForFieldSerializer¶
argumentsForFieldSerializer(
fieldName: String,
serializerForFieldValue: Expression): Seq[Expression]
argumentsForFieldSerializer creates a two-element collection of the following:
- Literal for the given
fieldName serializerForFieldValueExpression