Example usage for javax.lang.model.element VariableElement getEnclosingElement

List of usage examples for javax.lang.model.element VariableElement getEnclosingElement

Introduction

In this page you can find the example usage for javax.lang.model.element VariableElement getEnclosingElement.

Prototype

@Override
Element getEnclosingElement();

Source Link

Document

Returns the enclosing element of this variable.

Usage

From source file:net.pkhsolutions.ceres.common.builder.processor.BuildableAP.java

private boolean isValidPropertyElement(VariableElement element) {
    if (element.getEnclosingElement().getKind() == ElementKind.CONSTRUCTOR) {
        return true;
    } else {//from  w  w w. j  av a2 s . co m
        return ((element.getAnnotation(Ignore.class) == null)
                && (!element.getModifiers().contains(Modifier.STATIC))
                && (!element.getModifiers().contains(Modifier.FINAL)));
    }
}

From source file:org.mule.devkit.generation.mule.studio.editor.MuleStudioUtils.java

public String getFormattedDescription(VariableElement element) {
    Summary description = element.getAnnotation(Summary.class);
    if (description != null && StringUtils.isNotBlank(description.value())) {
        return formatDescription(description.value());
    }//from  w  w  w . j  av  a  2s  .  c om
    if (element.getKind() == ElementKind.PARAMETER) {
        Element executableElement = element.getEnclosingElement();
        return formatDescription(
                javaDocUtils.getParameterSummary(element.getSimpleName().toString(), executableElement));
    }
    return formatDescription(javaDocUtils.getSummary(element));
}

From source file:org.mule.devkit.validation.JavaDocValidator.java

private void validateAllParameters(GeneratorContext context, ExecutableElement method)
        throws ValidationException {
    for (VariableElement variable : method.getParameters()) {
        if (!hasParameterComment(variable.getSimpleName().toString(), variable.getEnclosingElement(),
                context)) {//from  w  w w  .  j a v a  2  s. c  o m
            throw new ValidationException(variable, "Parameter " + variable.getSimpleName().toString()
                    + " of method " + method.getSimpleName().toString()
                    + " is not properly documented. A matching @param in the method documentation was not found. ");
        }
    }
}