0 Replies Latest reply on Jun 21, 2008 9:27 PM by Lars Huber

    IdentityStore - Annotations on non public fields,methods

    Lars Huber Newbie

      Is it intended that you can only declare the IdentityManagement related annotations on public fields / methods? In JPA you are free to decide if you want to put the annotations to fields or methods. And if you decide the field strategy you will not put your fields to public.



      seam method: scanning for essential annotations


         public static AnnotatedBeanProperty scanForProperty(Class cls, Class<? extends Annotation> annotation)
         {
            for (Field f : cls.getFields())
            {
               if (f.isAnnotationPresent(annotation)) 
               {
                  return new AnnotatedBeanProperty(f, f.getAnnotation(annotation));
               }
            }
            
            for (Method m : cls.getMethods())
            {
               if (m.isAnnotationPresent(annotation))
               {
                  return new AnnotatedBeanProperty(m, m.getAnnotation(annotation));
               }
            }
            
            return null;
         }   
      



      By scanning for annotations I think it would be more appropriate to use cls.getDeclaredFields(). But then its necessary to scan recursively in superclasses


      cheers,
      Lars