Uploaded image for project: 'PicketLink'
  1. PicketLink
  2. PLINK-314

Annotations are not always recognized when defined in a field only

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • Major
    • PLINK_2.5.3.Beta1
    • PLINK_2.5.2.FInal
    • COMMON, IDM
    • None
    • Hide
      Property<String> property =PropertyQueries.<String>createQuery(this.mappedClass).addCriteria(new NamedPropertyCriteria("someProperty")).getFirstResult();
      
      if (property.getAnnotatedElement().isAnnotationPresent(SomeAnnotation.class)) {
           // this is always true if the annotation is declared on the field only.
      }
      
      Show
      Property< String > property =PropertyQueries.< String >createQuery( this .mappedClass).addCriteria( new NamedPropertyCriteria( "someProperty" )).getFirstResult(); if (property.getAnnotatedElement().isAnnotationPresent(SomeAnnotation.class)) { // this is always true if the annotation is declared on the field only. }

    Description

      Currently, annotations are not being recognized in fields. Eg.:

      @AttributeProperty
      private String firstName;
      
      @AttributeProperty
      private String lastName;
      
      @AttributeProperty
      private String email;
      

      The Property Query API should also consider the field when looking for annotations and also consider that if a field is annotated its corresponding accessor method inherits the annotation.

      This issue usually happens when using the NamedPropertyCriteria. This is because the accessor is first considered during the query and the field is not considered at all. So the resulting Property instance will always be a MethodProperty, which in this case does not have the annotation.

      Attachments

        Activity

          People

            psilva@redhat.com Pedro Igor Craveiro
            psilva@redhat.com Pedro Igor Craveiro
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: