Search in sources :

Example 1 with OBJECT_STORE

use of org.mule.runtime.extension.api.stereotype.MuleStereotypes.OBJECT_STORE in project mule by mulesoft.

the class ParameterAllowedStereotypesDeclarionEnricher method getStereotypes.

private List<StereotypeModel> getStereotypes(AnnotatedElement element) {
    ConfigReferences references = element.getAnnotation(ConfigReferences.class);
    if (references != null) {
        return stream(references.value()).map(ref -> newStereotype(ref.name(), ref.namespace()).withParent(CONFIG).build()).collect(toList());
    }
    ConfigReference ref = element.getAnnotation(ConfigReference.class);
    if (ref != null) {
        return singletonList(newStereotype(ref.name(), ref.namespace()).withParent(CONFIG).build());
    }
    if (element.getAnnotation(FlowReference.class) != null) {
        return singletonList(FLOW);
    }
    if (element.getAnnotation(ObjectStoreReference.class) != null) {
        return singletonList(OBJECT_STORE);
    }
    return emptyList();
}
Also used : ConfigReferences(org.mule.runtime.extension.api.annotation.ConfigReferences) OBJECT_STORE(org.mule.runtime.extension.api.stereotype.MuleStereotypes.OBJECT_STORE) ParameterDeclaration(org.mule.runtime.api.meta.model.declaration.fluent.ParameterDeclaration) StereotypeModel(org.mule.runtime.api.meta.model.stereotype.StereotypeModel) Collections.emptyList(java.util.Collections.emptyList) ExtensionLoadingContext(org.mule.runtime.extension.api.loader.ExtensionLoadingContext) FlowReference(org.mule.runtime.extension.api.annotation.param.reference.FlowReference) ImplementingParameterModelProperty(org.mule.runtime.module.extension.internal.loader.java.property.ImplementingParameterModelProperty) Collections.singletonList(java.util.Collections.singletonList) DeclaringMemberModelProperty(org.mule.runtime.module.extension.internal.loader.java.property.DeclaringMemberModelProperty) CONFIG(org.mule.runtime.extension.api.stereotype.MuleStereotypes.CONFIG) Collectors.toList(java.util.stream.Collectors.toList) List(java.util.List) StereotypeModelBuilder.newStereotype(org.mule.runtime.api.meta.model.stereotype.StereotypeModelBuilder.newStereotype) ConfigReference(org.mule.runtime.extension.api.annotation.param.reference.ConfigReference) ObjectStoreReference(org.mule.runtime.extension.api.annotation.param.reference.ObjectStoreReference) ParameterGroupDeclaration(org.mule.runtime.api.meta.model.declaration.fluent.ParameterGroupDeclaration) Arrays.stream(java.util.Arrays.stream) FLOW(org.mule.runtime.extension.api.stereotype.MuleStereotypes.FLOW) IdempotentDeclarationWalker(org.mule.runtime.extension.api.declaration.fluent.util.IdempotentDeclarationWalker) AnnotatedElement(java.lang.reflect.AnnotatedElement) ObjectStoreReference(org.mule.runtime.extension.api.annotation.param.reference.ObjectStoreReference) ConfigReferences(org.mule.runtime.extension.api.annotation.ConfigReferences) ConfigReference(org.mule.runtime.extension.api.annotation.param.reference.ConfigReference) FlowReference(org.mule.runtime.extension.api.annotation.param.reference.FlowReference)

Aggregations

AnnotatedElement (java.lang.reflect.AnnotatedElement)1 Arrays.stream (java.util.Arrays.stream)1 Collections.emptyList (java.util.Collections.emptyList)1 Collections.singletonList (java.util.Collections.singletonList)1 List (java.util.List)1 Collectors.toList (java.util.stream.Collectors.toList)1 ParameterDeclaration (org.mule.runtime.api.meta.model.declaration.fluent.ParameterDeclaration)1 ParameterGroupDeclaration (org.mule.runtime.api.meta.model.declaration.fluent.ParameterGroupDeclaration)1 StereotypeModel (org.mule.runtime.api.meta.model.stereotype.StereotypeModel)1 StereotypeModelBuilder.newStereotype (org.mule.runtime.api.meta.model.stereotype.StereotypeModelBuilder.newStereotype)1 ConfigReferences (org.mule.runtime.extension.api.annotation.ConfigReferences)1 ConfigReference (org.mule.runtime.extension.api.annotation.param.reference.ConfigReference)1 FlowReference (org.mule.runtime.extension.api.annotation.param.reference.FlowReference)1 ObjectStoreReference (org.mule.runtime.extension.api.annotation.param.reference.ObjectStoreReference)1 IdempotentDeclarationWalker (org.mule.runtime.extension.api.declaration.fluent.util.IdempotentDeclarationWalker)1 ExtensionLoadingContext (org.mule.runtime.extension.api.loader.ExtensionLoadingContext)1 CONFIG (org.mule.runtime.extension.api.stereotype.MuleStereotypes.CONFIG)1 FLOW (org.mule.runtime.extension.api.stereotype.MuleStereotypes.FLOW)1 OBJECT_STORE (org.mule.runtime.extension.api.stereotype.MuleStereotypes.OBJECT_STORE)1 DeclaringMemberModelProperty (org.mule.runtime.module.extension.internal.loader.java.property.DeclaringMemberModelProperty)1