Package javax.lang.model.type

Examples of javax.lang.model.type.DeclaredType


        if (element.getKind() == ElementKind.METHOD) {
            return true;
        }
        if (element.getKind() == ElementKind.CLASS) {
            Types typeUtils = environment.getTypeUtils();
            DeclaredType type = typeUtils.getDeclaredType((TypeElement) element);
            return typeUtils.isSubtype(type, environment.getDeclaredType(FlowDescription.class));
        }
        return false;
    }
View Full Code Here


     * @return 型のモデル
     * @throws IllegalArgumentException 引数に{@code null}が含まれる場合
     */
    public final Type t(TypeElement type) {
        Precondition.checkMustNotBeNull(type, "type"); //$NON-NLS-1$
        DeclaredType t = environment.getTypeUtils().getDeclaredType(type);
        return importer.resolve(new Jsr269(factory).convert(t));
    }
View Full Code Here

        }
        List<? extends TypeMirror> typeArgs = ((DeclaredType) representation).getTypeArguments();
        if (typeArgs.size() != 1) {
            return null;
        }
        DeclaredType raw = (DeclaredType) environment.getErasure(representation);
        if (environment.getTypeUtils().isSameType(raw, environment.getDeclaredType(Class.class)) == false) {
            return null;
        }
        return getTypeVariableName(typeArgs.get(0));
    }
View Full Code Here

        Types types = environment.getTypeUtils();
        if (types.isSameType(a, b)) {
            return true;
        }
        // EclipseJDTのバグでerasureは正しく計算されない模様
        DeclaredType at = (DeclaredType) a;
        DeclaredType bt = (DeclaredType) b;
        return at.asElement().equals(bt.asElement());
    }
View Full Code Here

        assert annotationType != null;
        if (elem == null) {
            return null;
        }
        for (AnnotationMirror annotation : elem.getAnnotationMirrors()) {
            DeclaredType aType = annotation.getAnnotationType();
            if (typeEqual(aType, annotationType)) {
                return annotation;
            }
        }
        return null;
View Full Code Here

                        PortTypeDescription.reference(outputType, input.getName()),
                        output.getParameterPosition(),
                        null);
            }
        }
        DeclaredType classType = environment.getDeclaredType(Class.class);
        for (OperatorPortDeclaration param : parameters) {
            // check is form of M<T>
            TypeMirror paramType = param.getType().getRepresentation();
            if (paramType.getKind() != TypeKind.DECLARED) {
                continue;
            }
            DeclaredType declParamType = (DeclaredType) paramType;
            if (declParamType.getTypeArguments().size() != 1) {
                continue;
            }
            // check is <: Class<?>
            if (types.isSameType(environment.getErasure(paramType), classType) == false) {
                continue;
            }
            if (types.isSameType(declParamType.getTypeArguments().get(0), outputType)) {
                return new OperatorPortDeclaration(
                        output.getKind(),
                        output.getDocumentation(),
                        output.getName(),
                        PortTypeDescription.reference(outputType, param.getName()),
View Full Code Here

    }

    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()));
View Full Code Here

    }

    private boolean isOperatorHelper(ExecutableElement method) {
        assert method != null;
        for (AnnotationMirror mirror : method.getAnnotationMirrors()) {
            DeclaredType annotationType = mirror.getAnnotationType();
            Element element = annotationType.asElement();
            if (element != null && element.getAnnotation(OperatorHelper.class) != null) {
                return true;
            }
        }
        return false;
View Full Code Here

        if (types.isSameType(erasedSelector, environment.getDeclaredType(List.class)) == false) {
            throw new ResolveException(MessageFormat.format(
                    "マスタ選択を行うメソッド{0}の1つめの引数は、List<...>の形式でなければなりません",
                    selectorMethod.getSimpleName()));
        }
        DeclaredType list = (DeclaredType) firstParameter;
        if (list.getTypeArguments().size() != 1) {
            throw new ResolveException(MessageFormat.format(
                    "マスタ選択を行うメソッド{0}の1つめの引数は、List<...>の形式でなければなりません",
                    selectorMethod.getSimpleName()));
        }
        TypeMirror selectorElement = list.getTypeArguments().get(0);
        return environment.loadDataModel(selectorElement);
    }
View Full Code Here

         */
        public TypeConstraint getTypeArgument() {
            if (type.getKind() != TypeKind.DECLARED) {
                return new TypeConstraint(environment.getTypeUtils().getNoType(TypeKind.NONE));
            }
            DeclaredType declared = (DeclaredType) type;
            List<? extends TypeMirror> arguments = declared.getTypeArguments();
            if (arguments.isEmpty()) {
                return new TypeConstraint(environment.getTypeUtils().getNoType(TypeKind.NONE));
            }
            return new TypeConstraint(arguments.get(0));
        }
View Full Code Here

TOP

Related Classes of javax.lang.model.type.DeclaredType

Copyright © 2018 www.massapicom. 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.