0 Replies Latest reply on Nov 10, 2011 11:49 AM by romulolana

    Problem to read a annotation inside of a module

    romulolana

      Consider that I have a module that has a class inside of it. This class has a annotation named ViewField in one of its methods.

       

      I'm trying to implement the following code:

       

      for (java.lang.reflect.Field field : beanClass.getDeclaredFields()) {

                                    if(field.isAnnotationPresent(ViewField.class))

                                    {

       

           // the code never enter here, although the annotation was present in the class

       

                                    }

                          }

       

      But apparently, the method field.isAnnotationPresent always returns false.

       

      The question:

      Can I use the reflection API to get annotations of a class inside of a jboss's module?

       

      Somebody already dealt with this problem?

       

      Thanks in advance,

       

      Rômulo Cordeiro Lana

      Systems Analyst – Public Prosecutor of the State of Minas Gerais – Brazil

      IT Superintendent – Information Systems – System Architecture

      Tel.: (+55 31) 3330-8340 – romulolana@mp.mg.gov.br