Search in sources :

Example 1 with WithDeclaringClass

use of org.mule.runtime.module.extension.api.loader.java.type.WithDeclaringClass in project mule by mulesoft.

the class MetadataScopeAdapter method initializeFromClass.

private void initializeFromClass(Type extensionType, WithDeclaringClass annotatedType, WithOutputDeclaration declaration) {
    // TODO MULE-10891: Add support for Source Callback parameters
    Optional<Class<?>> extensionClass = extensionType.getDeclaringClass();
    Optional<Class<?>> componentClass = annotatedType.getDeclaringClass();
    if (componentClass.isPresent() && extensionClass.isPresent()) {
        MetadataScope scope = getAnnotation(componentClass.get(), MetadataScope.class);
        scope = scope != null ? scope : getAnnotation(extensionClass.get(), MetadataScope.class);
        if (scope != null && !hasCustomStaticType(declaration.getOutput())) {
            this.keysResolver = ResolverSupplier.of(scope.keysResolver());
            this.outputResolver = ResolverSupplier.of(scope.outputResolver());
            this.attributesResolver = ResolverSupplier.of(scope.attributesResolver());
        }
    }
}
Also used : WithDeclaringClass(org.mule.runtime.module.extension.api.loader.java.type.WithDeclaringClass) MetadataScope(org.mule.runtime.extension.api.annotation.metadata.MetadataScope)

Aggregations

MetadataScope (org.mule.runtime.extension.api.annotation.metadata.MetadataScope)1 WithDeclaringClass (org.mule.runtime.module.extension.api.loader.java.type.WithDeclaringClass)1