3 Replies Latest reply on Mar 6, 2008 10:54 AM by adrian.brock

    General BeanInfo annotation visitor helper?

    starksm64

      For the AbstractManagedObjectFactory refactoring, and deployment template factory I'm working on, there is the common task of finding annotations from a root BeanInfo. Do we have general BeanInfo visitor helper? Worth creating it?


        • 1. Re: General BeanInfo annotation visitor helper?

           

          "scott.stark@jboss.org" wrote:
          For the AbstractManagedObjectFactory refactoring, and deployment template factory I'm working on, there is the common task of finding annotations from a root BeanInfo. Do we have general BeanInfo visitor helper? Worth creating it?


          I don't understand what you are tring to do?

          You can't in general visit BeanInfo because it is not a graph, the types
          can be self referencing either directly or transitively. Any "visit' would loop forever. ;-)

          e.g. simple example from the JDK
          public class Class extends Object {}
          public class Object
          {
           Class getClass();
          }
          


          The closest thing to a "visitor" (its not actually a visitor)
          is the WeakTypeCache used to build the ClassInfo, etc.


          • 2. Re: General BeanInfo annotation visitor helper?
            starksm64

            Its a graph with cycles, still has a simple graph style visitor pattern for a spanning tree. What I'm looking for is something like:

            interface BeanInfoVisitor
            {
             /** return true if the bean should be visited */
             boolean visit(BeanInfo bean);
             void visit(BeanInfo bean, ClassInfo info);
             void visit(BeanInfo bean, PropertyInfo info);
             void visit(BeanInfo bean, MethodInfo info);
            }
            



            • 3. Re: General BeanInfo annotation visitor helper?

              Nothing like that exists. There is somethiing similar in Ales's annotation adapter
              but it serves a different purpose.