Package javax.lang.model.type

Examples of javax.lang.model.type.DeclaredType.asElement()


      return fullName;
    }

    if (type instanceof DeclaredType) {
      DeclaredType declaredType = (DeclaredType) type;
      String name = InternalUtils.getSimpleName(declaredType.asElement());
      Element rootTypeElement = declaredType.asElement();
      for (DeclaredType enclosingType = JavaNodes.getEnclosingType(declaredType); enclosingType != null; enclosingType =
          JavaNodes.getEnclosingType(enclosingType)) {
        rootTypeElement = enclosingType.asElement();
        name = InternalUtils.getSimpleName(rootTypeElement) + "." + name;
View Full Code Here


    }

    if (type instanceof DeclaredType) {
      DeclaredType declaredType = (DeclaredType) type;
      String name = InternalUtils.getSimpleName(declaredType.asElement());
      Element rootTypeElement = declaredType.asElement();
      for (DeclaredType enclosingType = JavaNodes.getEnclosingType(declaredType); enclosingType != null; enclosingType =
          JavaNodes.getEnclosingType(enclosingType)) {
        rootTypeElement = enclosingType.asElement();
        name = InternalUtils.getSimpleName(rootTypeElement) + "." + name;
      }
View Full Code Here

      return CollectionHelper.asSet(
          new ConstraintCheckError( groupsMethod, null, "RETURN_TYPE_MUST_BE_CLASS_ARRAY" )
      );
    }

    boolean typeHasNameClass = type.asElement().getSimpleName().contentEquals( "Class" );
    boolean typeHasExactlyOneTypeArgument = type.getTypeArguments().size() == 1;
    boolean typeArgumentIsUnboundWildcard = validateWildcardBounds( type.getTypeArguments().get( 0 ), null, null );

    if ( !( typeHasNameClass && typeHasExactlyOneTypeArgument && typeArgumentIsUnboundWildcard ) ) {
      return CollectionHelper.asSet(
View Full Code Here

      return CollectionHelper.asSet(
          new ConstraintCheckError( payloadMethod, null, "PAYLOAD_RETURN_TYPE_MUST_BE_CLASS_ARRAY" )
      );
    }

    boolean typeHasNameClass = type.asElement().getSimpleName().contentEquals( "Class" );
    boolean typeHasExactlyOneTypeArgument = type.getTypeArguments().size() == 1;
    boolean typeArgumentIsWildcardWithPayloadExtendsBound = validateWildcardBounds(
        type.getTypeArguments().get( 0 ),
        annotationApiHelper.getDeclaredTypeByName( BeanValidationTypes.PAYLOAD ),
        null
View Full Code Here

        private String toString(AnnotationValue value) {
            if (value.getValue() instanceof TypeMirror) {
                TypeMirror tm = (TypeMirror) value.getValue();
                if (tm.getKind().equals(TypeKind.DECLARED)) {
                    DeclaredType dt = (DeclaredType) tm;
                    return getClassName((TypeElement) dt.asElement());
                }
            }
            return value.toString();
        }
View Full Code Here

    private static String getCanonicalTypeFrom(MirroredTypeException me) {
        TypeMirror tm = me.getTypeMirror();
        if (tm instanceof DeclaredType) {
            DeclaredType dec = (DeclaredType) tm;
            return ((TypeElement)dec.asElement()).getQualifiedName().toString();
        }
        return ""//ok?
    }

    private TypeMirror erasure(TypeMirror type) {
View Full Code Here

                List<? extends TypeMirror> superTypes = applications.getProcessingContext().directSupertypes((TypeMirror)provider.asType());
                if (superTypes.size() > 0) {
                  TypeMirror superType = superTypes.get(0);
                  if (superType.getKind() == TypeKind.DECLARED) {
                    DeclaredType declaredTypeSuper = (DeclaredType)superType;
                    TypeElement declaredSuperElement = (TypeElement)declaredTypeSuper.asElement();
                    if (ValueType.class.getName().equals(declaredSuperElement.getQualifiedName().toString())) {
                      TypeMirror argument = declaredTypeSuper.getTypeArguments().get(0);
                      if (argument instanceof DeclaredType) {
                        DeclaredType declaredArgumentType = (DeclaredType)argument;
                        Element declaredArgumentElement = declaredArgumentType.asElement();
View Full Code Here

                    TypeElement declaredSuperElement = (TypeElement)declaredTypeSuper.asElement();
                    if (ValueType.class.getName().equals(declaredSuperElement.getQualifiedName().toString())) {
                      TypeMirror argument = declaredTypeSuper.getTypeArguments().get(0);
                      if (argument instanceof DeclaredType) {
                        DeclaredType declaredArgumentType = (DeclaredType)argument;
                        Element declaredArgumentElement = declaredArgumentType.asElement();
                        if (declaredArgumentElement instanceof TypeElement) {
                          // Here we are
                          ElementHandle.Type valueType = ElementHandle.Type.create((TypeElement) declaredArgumentElement);
                          valueTypes.add(valueType);
                        }
View Full Code Here

    public TypeElement asDecl(TypeMirror m) {
        m = env.getTypeUtils().erasure(m);
        if (m.getKind().equals(TypeKind.DECLARED)) {
            DeclaredType d = (DeclaredType) m;
            return (TypeElement) d.asElement();
        } else
            return null;
    }

    public TypeElement asDecl(Class c) {
View Full Code Here

        Types tu = env.getTypeUtils();
        t = tu.erasure(t);
        if (t.getKind().equals(TypeKind.DECLARED)) {
            DeclaredType dt = (DeclaredType)t;
            if (!dt.getTypeArguments().isEmpty())
                return tu.getDeclaredType((TypeElement) dt.asElement());
        }
        return t;
    }

    public boolean isAbstract(TypeElement clazz) {
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.