use of org.drools.modelcompiler.builder.generator.declaredtype.api.SimpleAnnotationDefinition in project drools by kiegroup.
the class DMNDeclaredField method getFieldAnnotations.
@Override
public List<AnnotationDefinition> getFieldAnnotations() {
List<AnnotationDefinition> annotations = new ArrayList<>();
if (codeGenConfig.isWithJacksonAnnotation()) {
boolean isCollection = fieldDMNType.isCollection();
DMNType narrowTypeHint = isCollection ? DMNTypeUtils.getRootBaseTypeOfCollection(fieldDMNType) : fieldDMNType;
Optional<Class<?>> as = index.getJacksonDeserializeAs(narrowTypeHint);
as.ifPresent(asClass -> annotations.add(new SimpleAnnotationDefinition("com.fasterxml.jackson.databind.annotation.JsonDeserialize").addValue(isCollection ? "contentAs" : "as", asClass.getCanonicalName() + ".class")));
}
if (codeGenConfig.isWithMPOpenApiAnnotation() || codeGenConfig.isWithIOSwaggerOASv3Annotation()) {
annotateFieldWithOAS(annotations);
}
return annotations;
}
Aggregations