Search in sources :

Example 1 with TypeAnnotation

use of org.mule.metadata.api.annotation.TypeAnnotation in project mule by mulesoft.

the class CustomStaticTypeDeclarationEnricher method declareCustomType.

private <T extends BaseDeclaration & TypedDeclaration> void declareCustomType(T declaration, MetadataType target) {
    MetadataType type = declaration.getType();
    Class<?> clazz = getType(type).orElseThrow(() -> new IllegalStateException("Could not find class in type [" + type + "]"));
    Set<TypeAnnotation> a = new HashSet<>(asList(new ClassInformationAnnotation(clazz), new CustomDefinedStaticTypeAnnotation()));
    declaration.setType(enricher.enrich(target, a), false);
}
Also used : CustomDefinedStaticTypeAnnotation(org.mule.runtime.module.extension.internal.loader.annotations.CustomDefinedStaticTypeAnnotation) TypeAnnotation(org.mule.metadata.api.annotation.TypeAnnotation) MetadataType(org.mule.metadata.api.model.MetadataType) CustomDefinedStaticTypeAnnotation(org.mule.runtime.module.extension.internal.loader.annotations.CustomDefinedStaticTypeAnnotation) ClassInformationAnnotation(org.mule.metadata.java.api.annotation.ClassInformationAnnotation) HashSet(java.util.HashSet)

Aggregations

HashSet (java.util.HashSet)1 TypeAnnotation (org.mule.metadata.api.annotation.TypeAnnotation)1 MetadataType (org.mule.metadata.api.model.MetadataType)1 ClassInformationAnnotation (org.mule.metadata.java.api.annotation.ClassInformationAnnotation)1 CustomDefinedStaticTypeAnnotation (org.mule.runtime.module.extension.internal.loader.annotations.CustomDefinedStaticTypeAnnotation)1