Example usage for javax.lang.model.element NestingKind TOP_LEVEL

List of usage examples for javax.lang.model.element NestingKind TOP_LEVEL

Introduction

In this page you can find the example usage for javax.lang.model.element NestingKind TOP_LEVEL.

Prototype

NestingKind TOP_LEVEL

To view the source code for javax.lang.model.element NestingKind TOP_LEVEL.

Click Source Link

Document

A top-level type, not contained within another type.

Usage

From source file:org.androidtransfuse.adapter.element.ASTElementType.java

@Override
public boolean isInnerClass() {
    return typeElement.getNestingKind() != NestingKind.TOP_LEVEL && !isStatic();
}

From source file:org.bimserver.plugins.PhysicalJavaFileObject.java

@Override
public NestingKind getNestingKind() {
    return NestingKind.TOP_LEVEL;
}

From source file:therian.buildweaver.StandardOperatorsProcessor.java

/**
 * Must be a public static concrete class with a default constructor, public static zero-arg method, or public
 * static final field.//from w w  w .ja  v  a2 s  . c  om
 *
 * @param e
 * @return boolean
 */
private static boolean isValidStandardOperator(final Element e) {
    if (e.getKind() == ElementKind.FIELD) {
        return e.getModifiers().containsAll(EnumSet.of(Modifier.PUBLIC, Modifier.STATIC, Modifier.FINAL));
    }
    if (e.getKind() == ElementKind.METHOD) {
        return e.getModifiers().containsAll(EnumSet.of(Modifier.PUBLIC, Modifier.STATIC))
                && ((ExecutableElement) e).getParameters().isEmpty();
    }
    if (e.getKind() == ElementKind.CLASS) {
        if (e.getModifiers().contains(Modifier.ABSTRACT) || findDefaultConstructor((TypeElement) e) == null) {
            return false;
        }
        Element current = e;
        while (current.getKind() == ElementKind.CLASS) {
            final TypeElement t = (TypeElement) current;
            if (t.getNestingKind() == NestingKind.TOP_LEVEL) {
                return true;
            }
            if (t.getNestingKind() == NestingKind.MEMBER && t.getModifiers().contains(Modifier.STATIC)) {
                current = t.getEnclosingElement();
                continue;
            }
            break;
        }
    }
    return false;
}