Package javax.lang.model.element

Examples of javax.lang.model.element.AnnotationMirror


    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

      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

  }

  private Set<TypeMirror> determineSupportedTypes(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

  }

  @Override
  public Set<ConstraintCheckError> checkAnnotationType(TypeElement element, AnnotationMirror annotation) {

    AnnotationMirror constraintMirror = annotationApiHelper.getMirror(
        element.getAnnotationMirrors(), BeanValidationTypes.CONSTRAINT
    );
    boolean atLeastOneValidatorGiven = !annotationApiHelper.getAnnotationArrayValue(
        constraintMirror, "validatedBy"
    ).isEmpty();
View Full Code Here

   * @return the String value of the given annotation's parameter, or null if
   *         the parameter is not present on the annotation.
   */
  static AnnotationValue getAnnotationParamValueWithoutDefaults(Element target, CharSequence annotationQualifiedName,
          CharSequence paramName) {
    AnnotationMirror templatedAnnotation = getAnnotation(target, annotationQualifiedName);
    Map<? extends ExecutableElement, ? extends AnnotationValue> annotationParams = templatedAnnotation
            .getElementValues();
    for (Map.Entry<? extends ExecutableElement, ? extends AnnotationValue> param : annotationParams.entrySet()) {
      if (param.getKey().getSimpleName().contentEquals(paramName)) {
        return param.getValue();
      }
View Full Code Here

        for (final Object word : args) {
            assertTrue(msg.contains(word.toString()));
        }

        AnnotationMirror aMirror = null;
        msg = msgs.format(Kind.ERROR, note, ele, aMirror, args);

        for (final Object word : args) {
            assertTrue(msg.contains(word.toString()));
        }
View Full Code Here

        }
    }

    @Test
    public void testMessageFiltering() {
        AnnotationMirror aMirror = null;
        AnnotationValue aValue = null;
        Element ele = null;
        Object[] args = null;

        for (Kind kind : Kind.values()) {
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.