Examples of DeclaredType


Examples of javax.lang.model.type.DeclaredType

      if ( !propertyName.equals( elementPropertyName ) ) {
        continue;
      }

      DeclaredType type = determineDeclaredType( elem );
      if ( type == null ) {
        continue;
      }

      return determineTypes( propertyName, explicitTargetEntity, explicitMapKeyClass, type );
View Full Code Here

Examples of javax.lang.model.type.DeclaredType

    }
    return null;
  }

  private DeclaredType determineDeclaredType(Element elem) {
    DeclaredType type = null;
    if ( elem.asType() instanceof DeclaredType ) {
      type = ( (DeclaredType) elem.asType() );
    }
    else if ( elem.asType() instanceof ExecutableType ) {
      ExecutableType executableType = (ExecutableType) elem.asType();
View Full Code Here

Examples of javax.lang.model.type.DeclaredType

    log(elements.toString());

    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

Examples of javax.lang.model.type.DeclaredType

  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

Examples of javax.lang.model.type.DeclaredType

    "type != null",
    "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

Examples of javax.lang.model.type.DeclaredType

    }

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

Examples of javax.lang.model.type.DeclaredType

    public TypeMirror erasure(TypeMirror t) {
        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;
    }
View Full Code Here

Examples of javax.lang.model.type.DeclaredType

        throw new IllegalArgumentException();
    }

    public TypeMirror getTypeArgument(TypeMirror typeMirror, int i) {
        if (typeMirror != null && typeMirror.getKind().equals(TypeKind.DECLARED)) {
            DeclaredType declaredType = (DeclaredType) typeMirror;
            TypeMirror[] args = declaredType.getTypeArguments().toArray(new TypeMirror[declaredType.getTypeArguments().size()]);
            return args[i];
        } else throw new IllegalArgumentException();
    }
View Full Code Here

Examples of javax.lang.model.type.DeclaredType

        } else throw new IllegalArgumentException();
    }

    public boolean isParameterizedType(TypeMirror typeMirror) {
        if (typeMirror != null && typeMirror.getKind().equals(TypeKind.DECLARED)) {
            DeclaredType d = (DeclaredType) typeMirror;
            return !d.getTypeArguments().isEmpty();
        }
        return false;
    }
View Full Code Here

Examples of javax.lang.model.type.DeclaredType

    AnnotationValue nullableValue = AnnotationProcessingUtils
        .getAnnotationElementValue(procEnv, annotation, "nullable");
    AnnotationValue scopeValue = AnnotationProcessingUtils
        .getAnnotationElementValue(procEnv, annotation, "scope");

    DeclaredType referencedAnnotationClass = (DeclaredType) referencedAnnotationClassValue
        .getValue();
    TypeElement referencedAnnotationTypeElement = (TypeElement) referencedAnnotationClass
        .asElement();
    ConstraintScope scope = ConstraintScope.valueOf(scopeValue.getValue()
        .toString());
    Boolean nullable = Boolean.valueOf(nullableValue.getValue().toString());
    Map<Element, Set<Element>> elements = new HashMap<Element, Set<Element>>();
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.