Package javax.lang.model.element

Examples of javax.lang.model.element.AnnotationMirror


   */
  public static AnnotationMirror getAnnotationMirror(Element element, String fqcn) {
    assert element != null;
    assert fqcn != null;

    AnnotationMirror mirror = null;
    for ( AnnotationMirror am : element.getAnnotationMirrors() ) {
      if ( isAnnotationMirrorOfType( am, fqcn ) ) {
        mirror = am;
        break;
      }
View Full Code Here


    List<? extends Element> myMembers = searchedElement.getEnclosedElements();
    for ( Element subElement : myMembers ) {
      List<? extends AnnotationMirror> entityAnnotations =
          context.getElementUtils().getAllAnnotationMirrors( subElement );
      for ( Object entityAnnotation : entityAnnotations ) {
        AnnotationMirror annotationMirror = (AnnotationMirror) entityAnnotation;
        if ( isIdAnnotation( annotationMirror ) ) {
          defaultAccessType = getAccessTypeOfIdAnnotation( subElement );
          break;
        }
      }
View Full Code Here

    return TypeUtils.isAnnotationMirrorOfType( annotationMirror, Id.class )
        || TypeUtils.isAnnotationMirrorOfType( annotationMirror, EmbeddedId.class );
  }

  public static AccessType determineAnnotationSpecifiedAccessType(Element element) {
    final AnnotationMirror accessAnnotationMirror = TypeUtils.getAnnotationMirror( element, Access.class );
    AccessType forcedAccessType = null;
    if ( accessAnnotationMirror != null ) {
      Element accessElement = (Element) TypeUtils.getAnnotationValue(
          accessAnnotationMirror,
          DEFAULT_ANNOTATION_PARAMETER_NAME
View Full Code Here

   */
  public static AnnotationMirror getAnnotationMirror(Element element, String fqcn) {
    assert element != null;
    assert fqcn != null;

    AnnotationMirror mirror = null;
    for ( AnnotationMirror am : element.getAnnotationMirrors() ) {
      if ( isAnnotationMirrorOfType( am, fqcn ) ) {
        mirror = am;
        break;
      }
View Full Code Here

    List<? extends Element> myMembers = searchedElement.getEnclosedElements();
    for ( Element subElement : myMembers ) {
      List<? extends AnnotationMirror> entityAnnotations =
          context.getElementUtils().getAllAnnotationMirrors( subElement );
      for ( Object entityAnnotation : entityAnnotations ) {
        AnnotationMirror annotationMirror = (AnnotationMirror) entityAnnotation;
        if ( isIdAnnotation( annotationMirror ) ) {
          return getAccessTypeOfIdAnnotation( subElement );
        }
      }
    }
View Full Code Here

    return TypeUtils.isAnnotationMirrorOfType( annotationMirror, Constants.ID )
        || TypeUtils.isAnnotationMirrorOfType( annotationMirror, Constants.EMBEDDED_ID );
  }

  public static AccessType determineAnnotationSpecifiedAccessType(Element element) {
    final AnnotationMirror accessAnnotationMirror = TypeUtils.getAnnotationMirror( element, Constants.ACCESS );
    AccessType forcedAccessType = null;
    if ( accessAnnotationMirror != null ) {
      Element accessElement = (Element) TypeUtils.getAnnotationValue(
          accessAnnotationMirror,
          DEFAULT_ANNOTATION_PARAMETER_NAME
View Full Code Here

      for ( Element subElement : myMembers ) {
        List<? extends AnnotationMirror> entityAnnotations =
            context.getProcessingEnvironment().getElementUtils().getAllAnnotationMirrors( subElement );

        for ( Object entityAnnotation : entityAnnotations ) {
          AnnotationMirror annotationMirror = ( AnnotationMirror ) entityAnnotation;

          final String annotationType = annotationMirror.getAnnotationType().toString();

          //FIXME consider XML
          if ( annotationType.equals( Id.class.getName() )
              || annotationType.equals( EmbeddedId.class.getName() ) ) {
            context.logMessage( Diagnostic.Kind.NOTE, "Found id on" + searchedElement );
View Full Code Here

      DeclaredType constraintAnnotationType, TypeMirror type) {

    Set<TypeMirror> theValue = CollectionHelper.newHashSet();

    //the Constraint meta-annotation at the type declaration, e.g. "@Constraint(validatedBy = CheckCaseValidator.class)"
    AnnotationMirror constraintMetaAnnotation = getConstraintMetaAnnotation( constraintAnnotationType );

    //the validator classes, e.g. [CheckCaseValidator.class]
    List<? extends AnnotationValue> validatorClassReferences = getValidatorClassesFromConstraintMetaAnnotation(
        constraintMetaAnnotation
    );
View Full Code Here

   */
  private AnnotationMirror getConstraintMetaAnnotation(DeclaredType annotationType) {

    List<? extends AnnotationMirror> annotationMirrors = annotationType.asElement().getAnnotationMirrors();

    AnnotationMirror constraintMetaAnnotation = annotationApiHelper.getMirror(
        annotationMirrors, Constraint.class
    );

    if ( constraintMetaAnnotation == null ) {
      throw new IllegalArgumentException( "Given type " + annotationType + " isn't a constraint annotation type." );
View Full Code Here

      DeclaredType constraintAnnotationType, TypeMirror type) {

    Set<TypeMirror> theValue = CollectionHelper.newHashSet();

    //the Constraint meta-annotation at the type declaration, e.g. "@Constraint(validatedBy = CheckCaseValidator.class)"
    AnnotationMirror constraintMetaAnnotation = getConstraintMetaAnnotation( constraintAnnotationType );

    //the validator classes, e.g. [CheckCaseValidator.class]
    List<? extends AnnotationValue> validatorClassReferences = getValidatorClassesFromConstraintMetaAnnotation(
        constraintMetaAnnotation
    );
View Full Code Here

TOP

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

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.