I'm exploring the possibility of using a dynamic bean as fact object  as my fact object is very dynamic in nature.
I came across posts where people had recommended using  BeanGenerator from CGLIB.

This blog does a very good job of  explaining the details of classloader etc.

http://blog.athico.com/2006/12/dynamically-generated-class-beans-as.html

From what I can gather ( I'm new to both CGLIB and drools ) CGLIB seems to have the lowest lerning curve to achieve this.

I have the below sample on creating a dynamic bean with CGLIB

BeanGenerator bg = new BeanGenerator();
    bg.setSuperclass(FactContextPlaceHolder.class);
    bg.setNamingPolicy(new net.sf.cglib.core.NamingPolicy() {
      public String getClassName(String prefix, String source, Object key, Predicate names) {
        return prefix + "Impl";
      }
    });


 bg.addProperty("foo", Double.TYPE);
 g.addProperty("bar", String.class);
 FactContextPlaceHolder beanInst = (FactContextPlaceHolder)bg.create();


Here com.drools.test.FactContextPlaceHolder is set as super class and the generated class is obtained as com.drools.test.FactContextPlaceHolderImpl

I have  two basic question I am unable to find some answers on.

1) Once I create an object, how do I actually set the state of this object with fact values before setting it as fact object to drools session?
In the above example how do I set value of foo to "foot-test1" and value of bar to "bar-test1" on the beanInst.

2) In DRL if I set the package to some path say com.drools.test
  Should I then use FactContextPlaceHolderImpl as my fact Object?


Thanks
Kumar