use of com.palantir.dialogue.annotations.processor.data.ArgumentDefinition in project dialogue by palantir.
the class ServiceImplementationGenerator method serializer.
private FieldSpec serializer(ArgumentDefinition argumentDefinition, TypeName serializerType, String serializerFieldName) {
TypeName className = ArgumentTypes.caseOf(argumentDefinition.argType()).primitive((javaTypeName, _parameterSerializerMethodName, _isList) -> javaTypeName).mapType(javaTypeName -> javaTypeName).customType(typeName -> typeName).otherwiseEmpty().get();
ParameterizedTypeName deserializerType = ParameterizedTypeName.get(ClassName.get(Serializer.class), className);
return FieldSpec.builder(deserializerType, serializerFieldName).addModifiers(Modifier.PRIVATE, Modifier.FINAL).initializer("new $T().serializerFor(new $T<$T>() {})", serializerType, TypeMarker.class, className).build();
}
Aggregations