Package javax.lang.model.element

Examples of javax.lang.model.element.Element


    final TypeMirror superClass = entity.getTypeElement().getSuperclass();
    //superclass of Object is of NoType which returns some other kind
    if ( superClass.getKind() == TypeKind.DECLARED ) {
      //F..king Ch...t Have those people used their horrible APIs even once?
      final Element superClassElement = ( (DeclaredType) superClass ).asElement();
      String superClassName = ( (TypeElement) superClassElement ).getQualifiedName().toString();
      if ( extendsSuperMetaModel( superClassElement, entity.isMetaComplete(), context ) ) {
        pw.print( " extends " + superClassName + META_MODEL_CLASS_NAME_SUFFIX );
      }
    }
View Full Code Here


  private String getBinaryName(TypeElement element) {
    return getBinaryNameImpl(element, element.getSimpleName().toString());
  }

  private String getBinaryNameImpl(TypeElement element, String className) {
    Element enclosingElement = element.getEnclosingElement();

    if (enclosingElement instanceof PackageElement) {
      PackageElement pkg = (PackageElement) enclosingElement;
      if (pkg.isUnnamed()) {
        return className;
View Full Code Here

  /**
   * Verifies constraints on the callback method and class.
   */
  private Set<String> verifyCallback(ExecutableElement annotatedMethod,
      TypeElement annotationElement, String cls, String method) {
    Element classElement = annotatedMethod.getEnclosingElement();
    if (verifiedClasses.add(classElement)) {
      boolean hasNoArgConstructor = false;
      for (ExecutableElement ctor : ElementFilter.constructorsIn(
          classElement.getEnclosedElements())) {
        if (ctor.getParameters().isEmpty()) {
          hasNoArgConstructor = true;
          break;
        }
      }
View Full Code Here

  private String getBinaryName(TypeElement element) {
    return getBinaryNameImpl(element, element.getSimpleName().toString());
  }

  private String getBinaryNameImpl(Element element, String className) {
    Element enclosingElement = element.getEnclosingElement();

    if (enclosingElement instanceof PackageElement) {
      PackageElement pkg = (PackageElement) enclosingElement;
      if (pkg.isUnnamed()) {
        return className;
      }
      return pkg.getQualifiedName() + "." + className;
    }

    return getBinaryNameImpl(enclosingElement, enclosingElement.getSimpleName() + "$" + className);
  }
View Full Code Here

          }
      }
      mirror = box ? box(mirror) : mirror;
      if (isPrimitive(mirror))
        return ((PrimitiveType)mirror).toString();
      Element elem = typeUtility.asElement(mirror);
      if (elem == null)
          throw new RuntimeException(_loc.get("mmg-no-type", mirror).getMessage());
        return elem.toString();
    }
View Full Code Here

        return getDeclaredTypeName(comp, false);
      }
      mirror = box ? box(mirror) : mirror;
      if (isPrimitive(mirror))
        return ((PrimitiveType)mirror).toString();
      Element elem = typeUtility.asElement(mirror);
      if (elem == null)
          throw new RuntimeException(_loc.get("mmg-no-type", mirror).getMessage());
        return elem.toString();
    }
View Full Code Here

    /* The current element has contracts on its annotations. */
    result = hasContracts(e.getAnnotationMirrors());

    /* Checks superclass. */
    if (!result) {
      Element superclass =
          utils.typeUtils.asElement(e.getSuperclass());
      if (superclass != null) {
        /* Scans up in the syntax tree looking for contract annotations. */
        result = superclass.accept(this, null);
      }
    }

    /* Checks interfaces. */
    if (!result) {
      Collection<? extends TypeMirror> interfaces = e.getInterfaces();
      for (TypeMirror i : interfaces) {
        Element iface = utils.typeUtils.asElement(i);
        result = iface.accept(this, null);
        if (result) {
          break;
        }
      }
    }
View Full Code Here

    if (persistenceAnnotated.size() > 1) {
      messager.printMessage(Kind.ERROR, "Only one @Persistence activator is allowed within the project", persistenceAnnotated.iterator().next());
      return null;
    }
    Element persistenceClass = persistenceAnnotated.iterator().next();
    Persistence persistence = persistenceClass.getAnnotation(Persistence.class);
    return persistence;
  }
View Full Code Here

    if (annotated.size() > 1) {
      messager.printMessage(Kind.ERROR,
          "Only one " + hookAnnotation.getCanonicalName() + " hook is allowed with the project", annotated.iterator().next());
      return null;
    }
    Element updateElement = annotated.iterator().next();
    TypeElement typeElement = updateElement.accept(new TypeResolvingVisitor(), null);
    boolean implementsDbUpdate = false;
    for (TypeMirror typeMirror : typeElement.getInterfaces()) {
      if (typeMirror.toString().equals(hookInterface.getCanonicalName())) {
        implementsDbUpdate = true;
      }
View Full Code Here

  public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) {

    Set<? extends Element> badAnnotatedElements = roundEnv.getElementsAnnotatedWith(Bad.class);
    for (Element badAnnotatedElement : badAnnotatedElements) {
      ElementKind kind = badAnnotatedElement.getKind();
      Element enclosingElement = badAnnotatedElement.getEnclosingElement();
      String output;

      switch (kind) {
        case CLASS:
        case INTERFACE:
View Full Code Here

TOP

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

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.