Package javax.lang.model.type

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


            return true;
        }
        // EclipseJDTのバグでerasureは正しく計算されない模様
        DeclaredType at = (DeclaredType) a;
        DeclaredType bt = (DeclaredType) b;
        return at.asElement().equals(bt.asElement());
    }

    private String format(String message, Object... arguments) {
        if (arguments == null || arguments.length == 0) {
            return message;
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

          types[0] = TypeUtils.extractClosestRealTypeAsString( type.getTypeArguments().get( 0 ), context );
        }
        else {
          types[0] = explicitTargetEntity;
        }
        types[1] = COLLECTIONS.get( type.asElement().toString() );
      }
    }
    return types;
  }
View Full Code Here

    }
   
    // if empty, we're probably extending an existing factory
    if (factory.getTypeArguments().size() > 0) {
      DeclaredType argument = ((DeclaredType) factory.getTypeArguments().get(0));
      TypeElement factoryType = (TypeElement) argument.asElement();
      if (!factoryType.getQualifiedName().equals(declaration.getQualifiedName())) {
        success = false;
        messager.printMessage(ERROR,
            format("Expected EntityFactory<%s>, but found EntityFactory<%s>",
                declaration.getSimpleName(),
View Full Code Here

  public static boolean isString(TypeMirror mirror) {
    if (!(mirror instanceof DeclaredType))
      return false;
   
    DeclaredType type = (DeclaredType) mirror;
    Element e = type.asElement();
    if (!(e instanceof TypeElement))
      return false;
   
    TypeElement typeElement = (TypeElement) e;
   
View Full Code Here

    for (Element e : elements) {
      TypeElement providerImplementer = (TypeElement) e;
      AnnotationMirror providerAnnotation = getAnnotationMirror(e, ServiceProvider.class);
      DeclaredType providerInterface = getProviderInterface(providerAnnotation);
      TypeElement providerType = (TypeElement) providerInterface.asElement();

      log("provider interface: " + providerType.getQualifiedName());
      log("provider implementer: " + providerImplementer.getQualifiedName());

      try {
View Full Code Here

  private AnnotationMirror getAnnotationMirror(Element e, Class<? extends Annotation> klass) {
    List<? extends AnnotationMirror> annotationMirrors = e.getAnnotationMirrors();
    for (AnnotationMirror mirror : annotationMirrors) {
      log("mirror: " + mirror);
      DeclaredType type = mirror.getAnnotationType();
      TypeElement typeElement = (TypeElement) type.asElement();
      if (typeElement.getQualifiedName().contentEquals(klass.getName())) {
        return mirror;
      } else {
        log("klass name: [" + klass.getName() + "]");
        log("type name: [" + typeElement.getQualifiedName() + "]");
View Full Code Here

        new Predicate<AnnotationMirror>() {
          @Override
          public boolean apply(AnnotationMirror mirror) {
            log("mirror: " + mirror);
            DeclaredType type = mirror.getAnnotationType();
            TypeElement typeElement = (TypeElement) type.asElement();
            return typeElement.getQualifiedName().contentEquals(
                annotationElement.getQualifiedName());
          }
        });
  }
View Full Code Here

    "type.getKind() == javax.lang.model.type.TypeKind.DECLARED"
  })
  @Ensures("result == null || result.getDeclaredName().equals(type.toString())")
  ClassName getClassNameForType(TypeMirror type) {
    DeclaredType tmp = (DeclaredType) type;
    TypeElement element = (TypeElement) tmp.asElement();
    String binaryName = elementUtils.getBinaryName(element)
        .toString().replace('.', '/');
    return new ClassName(binaryName, type.toString());
  }
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

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.