Search in sources :

Example 1 with WithElement

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

the class AnnotationProcessorProblemsHandler method getElement.

private Element getElement(NamedObject component) {
    if (component instanceof EnrichableModel) {
        EnrichableModel enrichableModel = (EnrichableModel) component;
        Element element;
        element = getElement(enrichableModel, ExtensionOperationDescriptorModelProperty.class, mp -> mp.getOperationMethod().getElement());
        if (element != null) {
            return element;
        }
        element = getElement(enrichableModel, ExtensionParameterDescriptorModelProperty.class, mp -> mp.getExtensionParameter().getElement());
        if (element != null) {
            return element;
        }
        element = getElement(enrichableModel, ExtensionTypeDescriptorModelProperty.class, mp -> mp.getType().getElement());
        if (element != null) {
            return element;
        }
    }
    if (component instanceof WithElement) {
        Optional<? extends Element> optionalElement = ((WithElement) component).getElement();
        if (optionalElement.isPresent()) {
            return optionalElement.get();
        }
    }
    return null;
}
Also used : ProblemsReporter(org.mule.runtime.extension.api.loader.ProblemsReporter) WithElement(org.mule.runtime.module.extension.api.loader.java.type.WithElement) WARNING(javax.tools.Diagnostic.Kind.WARNING) NamedObject(org.mule.runtime.api.meta.NamedObject) ExtensionTypeDescriptorModelProperty(org.mule.runtime.module.extension.internal.loader.java.type.property.ExtensionTypeDescriptorModelProperty) Element(javax.lang.model.element.Element) ERROR(javax.tools.Diagnostic.Kind.ERROR) Function(java.util.function.Function) ProcessingEnvironment(javax.annotation.processing.ProcessingEnvironment) ExtensionParameterDescriptorModelProperty(org.mule.runtime.module.extension.internal.loader.java.type.property.ExtensionParameterDescriptorModelProperty) Optional(java.util.Optional) ModelProperty(org.mule.runtime.api.meta.model.ModelProperty) EnrichableModel(org.mule.runtime.api.meta.model.EnrichableModel) ProblemsHandler(org.mule.runtime.extension.internal.loader.ProblemsHandler) ExtensionOperationDescriptorModelProperty(org.mule.runtime.module.extension.internal.loader.java.type.property.ExtensionOperationDescriptorModelProperty) Messager(javax.annotation.processing.Messager) EnrichableModel(org.mule.runtime.api.meta.model.EnrichableModel) ExtensionOperationDescriptorModelProperty(org.mule.runtime.module.extension.internal.loader.java.type.property.ExtensionOperationDescriptorModelProperty) ExtensionTypeDescriptorModelProperty(org.mule.runtime.module.extension.internal.loader.java.type.property.ExtensionTypeDescriptorModelProperty) WithElement(org.mule.runtime.module.extension.api.loader.java.type.WithElement) WithElement(org.mule.runtime.module.extension.api.loader.java.type.WithElement) Element(javax.lang.model.element.Element) ExtensionParameterDescriptorModelProperty(org.mule.runtime.module.extension.internal.loader.java.type.property.ExtensionParameterDescriptorModelProperty)

Aggregations

Optional (java.util.Optional)1 Function (java.util.function.Function)1 Messager (javax.annotation.processing.Messager)1 ProcessingEnvironment (javax.annotation.processing.ProcessingEnvironment)1 Element (javax.lang.model.element.Element)1 ERROR (javax.tools.Diagnostic.Kind.ERROR)1 WARNING (javax.tools.Diagnostic.Kind.WARNING)1 NamedObject (org.mule.runtime.api.meta.NamedObject)1 EnrichableModel (org.mule.runtime.api.meta.model.EnrichableModel)1 ModelProperty (org.mule.runtime.api.meta.model.ModelProperty)1 ProblemsReporter (org.mule.runtime.extension.api.loader.ProblemsReporter)1 ProblemsHandler (org.mule.runtime.extension.internal.loader.ProblemsHandler)1 WithElement (org.mule.runtime.module.extension.api.loader.java.type.WithElement)1 ExtensionOperationDescriptorModelProperty (org.mule.runtime.module.extension.internal.loader.java.type.property.ExtensionOperationDescriptorModelProperty)1 ExtensionParameterDescriptorModelProperty (org.mule.runtime.module.extension.internal.loader.java.type.property.ExtensionParameterDescriptorModelProperty)1 ExtensionTypeDescriptorModelProperty (org.mule.runtime.module.extension.internal.loader.java.type.property.ExtensionTypeDescriptorModelProperty)1