Examples of TypeElement


Examples of javax.lang.model.element.TypeElement

    protected TypeElement findTypeElement(RoundEnvironment roundEnv, String className) {
        if (!isNullOrEmpty(className) && !"java.lang.Object".equals(className)) {
            Set<? extends Element> rootElements = roundEnv.getRootElements();
            for (Element rootElement : rootElements) {
                if (rootElement instanceof TypeElement) {
                    TypeElement typeElement = (TypeElement) rootElement;
                    String aRootName = canonicalClassName(typeElement.getQualifiedName().toString());
                    if (className.equals(aRootName)) {
                        return typeElement;
                    }
                }
            }
View Full Code Here

Examples of javax.lang.model.element.TypeElement

    }

    private Map<String, PropertyMirror> buildProperties() {
        Map<String, PropertyMirror> results = new LinkedHashMap<String, PropertyMirror>();
        Elements elementUtils = environment.getElementUtils();
        TypeElement element = (TypeElement) type.asElement();
        for (ExecutableElement method : ElementFilter.methodsIn(elementUtils.getAllMembers(element))) {
            PropertyMirror property = Util.toProperty(method);
            if (property != null) {
                results.put(property.getName(), property);
            }
View Full Code Here

Examples of javax.lang.model.element.TypeElement

        Precondition.checkMustNotBeNull(element, "element"); //$NON-NLS-1$
        if (element.getKind() != ElementKind.CLASS) {
            error(element, "フロー部品はクラスとして宣言される必要があります");
            return;
        }
        TypeElement typeDecl = (TypeElement) element;
        FlowPartClass result = toFlowPartClass(typeDecl);
        if (result != null) {
            collected.add(result);
        }
    }
View Full Code Here

Examples of javax.lang.model.element.TypeElement

    private FlowPartClass toFlowPartClass(Element element) {
        assert element != null;
        if (validateClassModifiers(element) == false) {
            return null;
        }
        TypeElement type = (TypeElement) element;
        ExecutableElement ctor = findConstructor(type);
        if (ctor == null) {
            return null;
        }
        validateConstructorModifiers(ctor);
View Full Code Here

Examples of javax.lang.model.element.TypeElement

        return collected;
    }

    private boolean validateClassModifiers(Element element) {
        assert element != null;
        TypeElement type = (TypeElement) element;
        DeclaredType superType = environment.getDeclaredType(FlowDescription.class);
        if (environment.getTypeUtils().isSubtype(type.asType(), superType) == false) {
            raiseInvalidClass(type, MessageFormat.format(
                    "フロー部品クラス{0}は{1}のサブクラスとして宣言する必要があります",
                    "{0}",
                    FlowDescription.class.getName()));
        }
        if (type.getEnclosingElement().getKind() != ElementKind.PACKAGE) {
            raiseInvalidClass(type, "フロー部品クラス{0}はパッケージ直下のトップレベルクラスとして宣言する必要があります");
        }
        if (type.getModifiers().contains(Modifier.PUBLIC) == false) {
            raiseInvalidClass(type, "フロー部品クラス{0}はpublicとして宣言する必要があります");
        }
        if (type.getModifiers().contains(Modifier.ABSTRACT)) {
            raiseInvalidClass(type, "フロー部品クラス{0}はabstractとして宣言できません");
        }
        return true;
    }
View Full Code Here

Examples of javax.lang.model.element.TypeElement

     */
    public void add(OperatorProcessor processor) {
        Precondition.checkMustNotBeNull(processor, "processor"); //$NON-NLS-1$
        Class<? extends Annotation> target = processor.getTargetAnnotationType();
        assert target != null;
        TypeElement annotation = environment.getElementUtils().getTypeElement(target.getCanonicalName());
        assert annotation != null;
        TypeMirror annotationType = annotation.asType();

        Set<? extends Element> elements = round.getElementsAnnotatedWith(annotation);
        for (Element element : elements) {
            ExecutableElement method = toOperatorMethodElement(element);
            if (method == null) {
View Full Code Here

Examples of javax.lang.model.element.TypeElement

    }

    private static boolean isKindMatched(OperatorCompilingEnvironment environment, TypeMirror type) {
        assert environment != null;
        assert type != null;
        TypeElement element = (TypeElement) environment.getTypeUtils().asElement(type);
        DataModelKind kind = element.getAnnotation(DataModelKind.class);
        return kind != null && kind.value().equals("DMDL");
    }
View Full Code Here

Examples of javax.lang.model.element.TypeElement

     * @param klass 対象のクラス
     * @param arguments 型引数の一覧
     * @return 宣言型
     */
    protected TypeMirror getType(Class<?> klass, TypeMirror...arguments) {
        TypeElement type = elements.getTypeElement(klass.getName());
        assertThat(klass.getName(), type, not(nullValue()));
        if (arguments.length == 0) {
            return types.erasure(type.asType());
        } else {
            return types.getDeclaredType(type, arguments);
        }
    }
View Full Code Here

Examples of javax.lang.model.element.TypeElement

     * @param klass 対象のクラス
     * @param arguments 型引数の一覧
     * @return 宣言型
     */
    protected TypeMirror getType(Class<?> klass, TypeMirror...arguments) {
        TypeElement type = elements.getTypeElement(klass.getName());
        assertThat(klass.getName(), type, not(nullValue()));
        if (arguments.length == 0) {
            return types.erasure(type.asType());
        } else {
            return types.getDeclaredType(type, arguments);
        }
    }
View Full Code Here

Examples of javax.lang.model.element.TypeElement

     */
    @Test
    public void typeVariable() {
        start(new Callback() {
            @Override protected void test() {
                TypeElement map = elements.getTypeElement(Map.class.getName());
                TypeParameterElement k = map.getTypeParameters().get(0);
                assertThat(
                    target.convert(k.asType()),
                    is((Type) f.newNamedType(f.newSimpleName("K"))));

                TypeElement list = elements.getTypeElement(List.class.getName());
                TypeParameterElement e = list.getTypeParameters().get(0);
                assertThat(
                    target.convert(e.asType()),
                    is((Type) f.newNamedType(f.newSimpleName("E"))));
            }
        });
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.