Package javax.lang.model.element

Examples of javax.lang.model.element.AnnotationMirror


        msgs.record(Kind.ERROR, note, ele);
        assertTrue(host.getCount(Kind.ERROR) == 1);
        host = new MessagerMockup();
        msgs = new I18NProcessorMessages(host, Locale.ROOT, Kind.ERROR);

        AnnotationMirror aMirror = null;
        msgs.record(Kind.ERROR, note, ele, aMirror);
        assertTrue(host.getCount(Kind.ERROR) == 1);
        host = new MessagerMockup();
        msgs = new I18NProcessorMessages(host, Locale.ROOT, Kind.ERROR);
View Full Code Here


    }
    return false;
  }

  private void processElement(Element element) {
    AnnotationMirror annotation = getAnnotation(element,
        configurationPropertiesAnnotation());
    String prefix = getPrefix(annotation);
    if (annotation != null) {
      if (element instanceof TypeElement) {
        processAnnotatedTypeElement(prefix, (TypeElement) element);
View Full Code Here

      String name = entry.getKey();
      ExecutableElement getter = entry.getValue();
      VariableElement field = members.getFields().get(name);
      Element returnType = this.processingEnv.getTypeUtils().asElement(
          getter.getReturnType());
      AnnotationMirror annotation = getAnnotation(getter,
          configurationPropertiesAnnotation());
      boolean isNested = getAnnotation(field,
          nestedConfigurationPropertyAnnotation()) != null;
      if (returnType != null && returnType instanceof TypeElement
          && annotation == null) {
View Full Code Here

   */
  public static AnnotationMirror getAnnotationMirror(Element element, Class<? extends Annotation> clazz) {
    assert element != null;
    assert clazz != null;

    AnnotationMirror mirror = null;
    for ( AnnotationMirror am : element.getAnnotationMirrors() ) {
      if ( isAnnotationMirrorOfType( am, clazz ) ) {
        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

  }

  private Set<TypeMirror> getSupportedTypesForCustomConstraint(DeclaredType constraintAnnotationType) {

    //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, BeanValidationTypes.CONSTRAINT
    );

    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

   */
  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

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.