Search in sources :

Example 1 with MethodDocumentation

use of org.mule.runtime.module.extension.internal.capability.xml.schema.MethodDocumentation in project mule by mulesoft.

the class SourcesDescriptionDocumenter method documentCallback.

private void documentCallback(Map<String, Element> methods, SourceCallbackDeclaration cb) {
    Element method = methods.get(cb.getName());
    if (method != null) {
        MethodDocumentation documentation = processor.getMethodDocumentation(processingEnv, method);
        parameterDeclarer.document(cb, method, documentation);
    }
}
Also used : MethodDocumentation(org.mule.runtime.module.extension.internal.capability.xml.schema.MethodDocumentation) Element(javax.lang.model.element.Element) TypeElement(javax.lang.model.element.TypeElement)

Example 2 with MethodDocumentation

use of org.mule.runtime.module.extension.internal.capability.xml.schema.MethodDocumentation in project mule by mulesoft.

the class OperationDescriptionDocumenter method documentOperations.

private void documentOperations(WithOperationsDeclaration<?> declaration, Map<String, Element> methods) {
    for (OperationDeclaration operation : declaration.getOperations()) {
        Element method = methods.get(operation.getName());
        // the one which defined the operation being processed
        if (method == null) {
            continue;
        }
        MethodDocumentation documentation = processor.getMethodDocumentation(processingEnv, method);
        operation.setDescription(documentation.getSummary());
        parameterDeclarer.document(operation, method, documentation);
    }
}
Also used : MethodDocumentation(org.mule.runtime.module.extension.internal.capability.xml.schema.MethodDocumentation) Element(javax.lang.model.element.Element) TypeElement(javax.lang.model.element.TypeElement) OperationDeclaration(org.mule.runtime.api.meta.model.declaration.fluent.OperationDeclaration)

Example 3 with MethodDocumentation

use of org.mule.runtime.module.extension.internal.capability.xml.schema.MethodDocumentation in project mule by mulesoft.

the class ParameterDescriptionDocumenter method document.

/**
 * Describes parameters that are defined as Method parameters.
 */
void document(ParameterizedDeclaration<?> parameterized, Element method, MethodDocumentation documentation) {
    parameterized.getAllParameters().forEach(p -> {
        String description = documentation.getParameters().get(p.getName());
        if (description != null) {
            p.setDescription(description);
        }
    });
    if (method instanceof ExecutableElement) {
        ((ExecutableElement) method).getParameters().stream().filter(e -> e.getAnnotation(ParameterGroup.class) != null).forEach(group -> {
            TypeElement typeElement = (TypeElement) processingEnv.getTypeUtils().asElement(group.asType());
            document(parameterized, typeElement);
        });
    }
}
Also used : MethodDocumentation(org.mule.runtime.module.extension.internal.capability.xml.schema.MethodDocumentation) Map(java.util.Map) ExecutableElement(javax.lang.model.element.ExecutableElement) ParameterizedDeclaration(org.mule.runtime.api.meta.model.declaration.fluent.ParameterizedDeclaration) ProcessingEnvironment(javax.annotation.processing.ProcessingEnvironment) VariableElement(javax.lang.model.element.VariableElement) Element(javax.lang.model.element.Element) TypeElement(javax.lang.model.element.TypeElement) Parameter(org.mule.runtime.extension.api.annotation.param.Parameter) ParameterGroup(org.mule.runtime.extension.api.annotation.param.ParameterGroup) Collectors(java.util.stream.Collectors) TypeElement(javax.lang.model.element.TypeElement) ExecutableElement(javax.lang.model.element.ExecutableElement) ParameterGroup(org.mule.runtime.extension.api.annotation.param.ParameterGroup)

Aggregations

Element (javax.lang.model.element.Element)3 TypeElement (javax.lang.model.element.TypeElement)3 MethodDocumentation (org.mule.runtime.module.extension.internal.capability.xml.schema.MethodDocumentation)3 Map (java.util.Map)1 Collectors (java.util.stream.Collectors)1 ProcessingEnvironment (javax.annotation.processing.ProcessingEnvironment)1 ExecutableElement (javax.lang.model.element.ExecutableElement)1 VariableElement (javax.lang.model.element.VariableElement)1 OperationDeclaration (org.mule.runtime.api.meta.model.declaration.fluent.OperationDeclaration)1 ParameterizedDeclaration (org.mule.runtime.api.meta.model.declaration.fluent.ParameterizedDeclaration)1 Parameter (org.mule.runtime.extension.api.annotation.param.Parameter)1 ParameterGroup (org.mule.runtime.extension.api.annotation.param.ParameterGroup)1