Package javax.lang.model.element

Examples of javax.lang.model.element.Name


    }
  }

  private Set<AnnotationMirror> getComposingConstraints(DeclaredType constraintAnnotationType) {

    Name key = getName( constraintAnnotationType );

    Set<AnnotationMirror> composingConstraints = composingConstraintsByConstraints.get( key );

    if( composingConstraints != null ) {
      return composingConstraints;
View Full Code Here



                }
                else if(element.getAnnotation(NoGatekeeper.class)==null)
                {
                    Name simpleName = element.getEnclosingElement()!=null ? element.getEnclosingElement().getSimpleName() : element.getSimpleName();
                    System.out.println(simpleName +"(#"+nameToken.value()+")" +" is missing @AccessControl annotation!");
                }
            }
        }
    }
View Full Code Here

  /** @return type represents a Throwable type (e.g. Exception, Error) **/
  public static boolean isThrowable(TypeMirror type) {
    while (type != null && type.getKind() == TypeKind.DECLARED) {
      DeclaredType dt = (DeclaredType) type;
      TypeElement elem = (TypeElement) dt.asElement();
      Name name = elem.getQualifiedName();
      if ("java.lang.Throwable".contentEquals(name)) {
        return true;
      }
      type = elem.getSuperclass();
    }
View Full Code Here

    }

    if (tr.getKind() == Tree.Kind.MEMBER_SELECT) {
      tr = ((MemberSelectTree) tr).getExpression();
      if (tr.getKind() == Tree.Kind.IDENTIFIER) {
        Name ident = ((IdentifierTree) tr).getName();
        return ident.contentEquals("this") || ident.contentEquals("super");
      }
    }

    return false;
  }
View Full Code Here

   *            the method invocation to check
   * @return true if this is a super call to the {@link Enum} constructor
   */
  public static boolean isEnumSuper(MethodInvocationTree node) {
    ExecutableElement ex = TreeUtils.elementFromUse(node);
    Name name = ElementUtils.getQualifiedClassName(ex);
    boolean correctClass = "java.lang.Enum".contentEquals(name);
    boolean correctMethod = "<init>".contentEquals(ex.getSimpleName());
    return correctClass && correctMethod;
  }
View Full Code Here

    return getAnnotation(target, annotationQualifiedName) != null;
  }

  public static AnnotationMirror getAnnotation(Element target, CharSequence annotationQualifiedName) {
    for (AnnotationMirror am : target.getAnnotationMirrors()) {
      Name annotationClassName = ((TypeElement) am.getAnnotationType().asElement()).getQualifiedName();
      if (annotationClassName.contentEquals(annotationQualifiedName)) {
        return am;
      }
    }
    return null;
  }
View Full Code Here

   * @return the property name defined by the method according to JavaBeans
   *         convention, or null if the method does not define a JavaBeans
   *         property setter/getter.
   */
  static String propertyNameOfMethod(Element el) {
    Name methodName = el.getSimpleName();
    String propertyName = null;
    if (methodName.length() > 3 && "get".contentEquals(methodName.subSequence(0, 3))) {
      StringBuilder sb = new StringBuilder(methodName.length() - 3);
      sb.append(Character.toLowerCase(methodName.charAt(3)));
      sb.append(methodName.subSequence(4, methodName.length()));
      propertyName = sb.toString();
    }
    else if (methodName.length() > 2 && "is".contentEquals(methodName.subSequence(0, 2))) {
      StringBuilder sb = new StringBuilder(methodName.length() - 2);
      sb.append(Character.toLowerCase(methodName.charAt(2)));
      sb.append(methodName.subSequence(3, methodName.length()));
      propertyName = sb.toString();
    }
    else if (methodName.length() > 3 && "set".contentEquals(methodName.subSequence(0, 2))) {
      StringBuilder sb = new StringBuilder(methodName.length() - 3);
      sb.append(Character.toLowerCase(methodName.charAt(3)));
      sb.append(methodName.subSequence(4, methodName.length()));
      propertyName = sb.toString();
    }
    return propertyName;
  }
View Full Code Here

        return res;
    }

    protected final boolean needLongName(ExecutableElement method,
                                         TypeElement clazz) {
        Name methodName = method.getSimpleName();
        for (ExecutableElement memberMethod: methods) {
            if ((memberMethod != method) &&
                memberMethod.getModifiers().contains(Modifier.NATIVE) &&
                    (methodName.equals(memberMethod.getSimpleName())))
                return true;
        }
        return false;
    }
View Full Code Here

    }
  }

  private Set<TypeMirror> getSupportedTypesForBuiltInConstraint(DeclaredType annotation) {

    Name key = getName( annotation );
    Set<TypeMirror> allowedTypes = builtInConstraints.get( key );

    // create a mapping for the given annotation type if required
    if ( allowedTypes == null ) {
      allowedTypes = CollectionHelper.newHashSet();
View Full Code Here

    }
  }

  private Set<TypeMirror> getAllowedTypesForBuiltInConstraint(Class<? extends Annotation> annotation) {

    Name key = elementUtils.getName( annotation.getSimpleName() );
    Set<TypeMirror> allowedTypes = builtInConstraints.get( key );

    // create a mapping for the given annotation type if required
    if ( allowedTypes == null ) {
      allowedTypes = CollectionHelper.newHashSet();
View Full Code Here

TOP

Related Classes of javax.lang.model.element.Name

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.