Package javax.lang.model.element

Examples of javax.lang.model.element.TypeElement


      annotatedElementsOfMethod.add(element);
    }
  }

  private void checkOverriddenMethods(ExecutableElement method) {
    TypeElement declaringType = (TypeElement)method.getEnclosingElement();
    Set<Element> errorElements = new HashSet<Element>();
    Set<Element> warnedElements = new HashSet<Element>();
    typeLoop:
    for (TypeMirror supertypeMirror : getAllSupertypes(processingEnv.getTypeUtils().getDeclaredType(declaringType))) {
      for (Element element : ((TypeElement)processingEnv.getTypeUtils().asElement(supertypeMirror)).getEnclosedElements()) {
View Full Code Here


  private Set<ConstraintCheckError> checkAnnotationValue(TypeElement element, AnnotationMirror annotation) {
    Set<ConstraintCheckError> errors = CollectionHelper.newHashSet();
    AnnotationValue value = annotationApiHelper.getAnnotationValue( annotation, "value" );
    TypeMirror valueType = (TypeMirror) value.getValue();
    TypeElement valueElement = (TypeElement) typeUtils.asElement( valueType );

    if ( valueElement.getKind().isInterface() || valueElement.getModifiers().contains( Modifier.ABSTRACT ) ) {
      errors.add(
          new ConstraintCheckError(
              element,
              annotation,
              "GROUP_SEQUENCE_PROVIDER_ANNOTATION_VALUE_MUST_BE_AN_IMPLEMENTATION_CLASS"
View Full Code Here

      String packageName = mappings.getPackage();

      for ( Entity entity : mappings.getEntity() ) {
        String name = entity.getClazz();
        fqcn = StringUtil.determineFullyQualifiedClassName( packageName, name );
        TypeElement element = context.getTypeElementForFullyQualifiedName( fqcn );
        if ( element != null ) {
          TypeUtils.determineAccessTypeForHierarchy( element, context );
        }
      }

      for ( org.hibernate.jpamodelgen.xml.jaxb.MappedSuperclass mappedSuperClass : mappings.getMappedSuperclass() ) {
        String name = mappedSuperClass.getClazz();
        fqcn = StringUtil.determineFullyQualifiedClassName( packageName, name );
        TypeElement element = context.getTypeElementForFullyQualifiedName( fqcn );
        if ( element != null ) {
          TypeUtils.determineAccessTypeForHierarchy( element, context );
        }
      }
    }
View Full Code Here

      this.type = elem;
    }

    @Override
    public Boolean visitDeclared(DeclaredType declaredType, Element element) {
      TypeElement returnedElement = (TypeElement) context.getTypeUtils().asElement( declaredType );

      String fqNameOfReturnType = returnedElement.getQualifiedName().toString();
      String collection = Constants.COLLECTIONS.get( fqNameOfReturnType );
      if ( collection != null ) {
        TypeMirror collectionElementType = TypeUtils.getCollectionElementType(
            declaredType, fqNameOfReturnType, null, context
        );
        returnedElement = (TypeElement) context.getTypeUtils().asElement( collectionElementType );
      }

      if ( type.getQualifiedName().toString().equals( returnedElement.getQualifiedName().toString() ) ) {
        return Boolean.TRUE;
      }
      else {
        return Boolean.FALSE;
      }
View Full Code Here

  public static TypeMirror getCollectionElementType(DeclaredType t, String fqNameOfReturnedType, String explicitTargetEntityName, Context context) {
    TypeMirror collectionElementType;
    if ( explicitTargetEntityName != null ) {
      Elements elements = context.getElementUtils();
      TypeElement element = elements.getTypeElement( explicitTargetEntityName );
      collectionElementType = element.asType();
    }
    else {
      List<? extends TypeMirror> typeArguments = t.getTypeArguments();
      if ( typeArguments.size() == 0 ) {
        throw new MetaModelGenerationException( "Unable to determine collection type" );
View Full Code Here

      this.context = context;
    }

    @Override
    public String visitDeclared(DeclaredType declaredType, Element element) {
      TypeElement returnedElement = (TypeElement) context.getTypeUtils().asElement( declaredType );
      String fqNameOfReturnType = null;
      if ( containsAnnotation( returnedElement, Embeddable.class ) ) {
        fqNameOfReturnType = returnedElement.getQualifiedName().toString();
      }
      return fqNameOfReturnType;
    }
View Full Code Here

  }

  @Override
  public AnnotationMetaAttribute visitDeclared(DeclaredType declaredType, Element element) {
    AnnotationMetaAttribute metaAttribute = null;
    TypeElement returnedElement = (TypeElement) context.getTypeUtils().asElement( declaredType );
    // WARNING: .toString() is necessary here since Name equals does not compare to String
    String fqNameOfReturnType = returnedElement.getQualifiedName().toString();
    String collection = Constants.COLLECTIONS.get( fqNameOfReturnType );
    String targetEntity = getTargetEntity( element.getAnnotationMirrors() );
    if ( collection != null ) {
      return createMetaCollectionAttribute(
          declaredType, element, fqNameOfReturnType, collection, targetEntity
      );
    }
    else if ( isBasicAttribute( element, returnedElement ) ) {
      String type = targetEntity != null ? targetEntity : returnedElement.getQualifiedName().toString();
      return new AnnotationMetaSingleAttribute( entity, element, type );
    }
    return metaAttribute;
  }
View Full Code Here

    if ( TypeUtils.containsAnnotation( element, ElementCollection.class ) ) {
      String explicitTargetEntity = getTargetEntity( element.getAnnotationMirrors() );
      TypeMirror collectionElementType = TypeUtils.getCollectionElementType(
          declaredType, fqNameOfReturnType, explicitTargetEntity, context
      );
      final TypeElement collectionElement = (TypeElement) context.getTypeUtils()
          .asElement( collectionElementType );
      AccessTypeInformation accessTypeInfo = context.getAccessTypeInfo( collectionElement.getQualifiedName().toString() );
      if ( accessTypeInfo == null ) {
        AccessType explicitAccessType = TypeUtils.determineAnnotationSpecifiedAccessType(
            collectionElement
        );
        accessTypeInfo = new AccessTypeInformation(
            collectionElement.getQualifiedName().toString(),
            explicitAccessType,
            entity.getEntityAccessTypeInfo().getAccessType()
        );
        context.addAccessTypeInformation(
            collectionElement.getQualifiedName().toString(), accessTypeInfo
        );
      }
      else {
        accessTypeInfo.setDefaultAccessType( entity.getEntityAccessTypeInfo().getAccessType() );
      }
View Full Code Here

  }

  @Override
  public Boolean visitArray(ArrayType t, Element element) {
    TypeMirror componentMirror = t.getComponentType();
    TypeElement componentElement = (TypeElement) context.getTypeUtils().asElement( componentMirror );

    return Constants.BASIC_ARRAY_TYPES.contains( componentElement.getQualifiedName().toString() );
  }
View Full Code Here

    if ( ElementKind.ENUM.equals( element.getKind() ) ) {
      return Boolean.TRUE;
    }

    if ( ElementKind.CLASS.equals( element.getKind() ) || ElementKind.INTERFACE.equals( element.getKind() ) ) {
      TypeElement typeElement = ( (TypeElement) element );
      String typeName = typeElement.getQualifiedName().toString();
      if ( Constants.BASIC_TYPES.contains( typeName ) ) {
        return Boolean.TRUE;
      }
      if ( TypeUtils.containsAnnotation( element, Embeddable.class ) ) {
        return Boolean.TRUE;
      }
      for ( TypeMirror mirror : typeElement.getInterfaces() ) {
        TypeElement interfaceElement = (TypeElement) context.getTypeUtils().asElement( mirror );
        if ( "java.io.Serializable".equals( interfaceElement.getQualifiedName().toString() ) ) {
          return Boolean.TRUE;
        }
      }
    }
    return Boolean.FALSE;
View Full Code Here

TOP

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

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.