use of org.apache.camel.component.hl7.Hl7Terser in project camel-quarkus by apache.
the class Hl7Processor method registerForReflection.
@BuildStep
void registerForReflection(BuildProducer<ReflectiveClassBuildItem> reflectiveClass, CombinedIndexBuildItem combinedIndex) {
IndexView index = combinedIndex.getIndex();
// Register hapi model types for reflection
String[] hapiStructureClasses = index.getAllKnownImplementors(DotName.createSimple(Structure.class.getName())).stream().map(classInfo -> classInfo.name().toString()).toArray(String[]::new);
String[] hapiTypeClasses = index.getAllKnownImplementors(DotName.createSimple(Type.class.getName())).stream().map(classInfo -> classInfo.name().toString()).toArray(String[]::new);
reflectiveClass.produce(new ReflectiveClassBuildItem(false, true, hapiStructureClasses));
reflectiveClass.produce(new ReflectiveClassBuildItem(false, true, hapiTypeClasses));
// Beans that have the Hl7Terser annotation require reflective access
String[] terserBeans = index.getAnnotations(DotName.createSimple(Hl7Terser.class.getName())).stream().map(AnnotationInstance::target).map(annotationTarget -> {
if (annotationTarget.kind().equals(AnnotationTarget.Kind.FIELD)) {
return annotationTarget.asType().asClass();
} else if (annotationTarget.kind().equals(AnnotationTarget.Kind.METHOD)) {
return annotationTarget.asMethod().declaringClass();
} else if (annotationTarget.kind().equals(AnnotationTarget.Kind.METHOD_PARAMETER)) {
return annotationTarget.asMethodParameter().method().declaringClass();
}
return null;
}).filter(CamelSupport::isConcrete).map(classInfo -> classInfo.name().toString()).toArray(String[]::new);
reflectiveClass.produce(new ReflectiveClassBuildItem(true, false, terserBeans));
}
Aggregations