javassist has low level apis that allow accessing elements reflective data, and after that it's same old reflection code,
for example when I treid t make GenericComponents for tapestry I wanted to make a worker and put generic information into ComponentResources @Component private EntityEditComponent<Vessel, Long> _vesselEdit; I found the way to get the declaration for the field from javassist: I messed a bit with //ClassTransformation is enhanced to return : CtField.getFieldInfo2... FieldInfo info = transformation.getFieldInfo2(fieldName); SignatureAttribute.ClassType type = (ClassType) SignatureAttribute.toFieldSignature(sig.getSignature()); System.out.println(fieldName+":TYPE:"+type);//QDEBUG remove TypeArgument[] typeArguments = type.getTypeArguments(); for (int i = 0; i < typeArguments.length; i++) { System.out.println("TYPE par: "+typeArguments[i]);//QDEBUG remove } the output is : _vesselEdit:TYPE:tapestryutil.base.EntityEditComponent<hr.crup.eri.web.entities.Vessel, java.lang.Long> TYPE par: hr.crup.eri.web.entities.Vessel TYPE par: java.lang.Long after that I just could not get the parameter into ComponentResources this was all nice but after some digging I found this nice class on jboss http://viewvc.jboss.org/cgi-bin/viewvc.cgi/jbossretro/trunk/src/main/java/org/jboss/lang/GenericsHelper.java/?revision=227&view=markup&pathrev=227 it has all you need for generics in javassist Davor Hrg On Fri, Mar 21, 2008 at 11:21 PM, Howard Lewis Ship <[EMAIL PROTECTED]> wrote: > Yes ... but that information isn't always exposed properly via the > Javassist APIs. > > > > On Fri, Mar 21, 2008 at 3:19 AM, Davor Hrg <[EMAIL PROTECTED]> wrote: > > Method parameter types contain generic information just like > > properties and method return types. It is quite similar to stuff > > in property conduit source. > > > > Davor Hrg > > > > > > > > > > On Fri, Mar 21, 2008 at 6:41 AM, Howard Lewis Ship <[EMAIL PROTECTED]> > wrote: > > > Yes, I think the generics logic isn't smart enough for this case, that > > > is, to identify and convert the parameter of the event handler method. > > > You can add this as a bug, but I'm not even sure how to start making > > > this work correctly! > > > > > > > > > > > > On Thu, Mar 20, 2008 at 9:04 PM, Angelo Chen <[EMAIL PROTECTED]> wrote: > > > > > > > > Hi, > > > > > > > > I'm trying out generic in 5.0.11, I have a base class ObjectEdit, > then > > > > > > > > public class ObjectEdit<T> { > > > > > > > > private T object; > > > > public T getObject() { return object;} > > > > public void setObject(T object) { this.object = object;} > > > > public void onActivate(T obj) { object = obj;} > > > > public T onPassivate() { return object; } > > > > } > > > > > > > > I was hoping that I can just extend it like this: > > > > > > > > public class UserEdit extends ObjectEdit <Usr> { > > > > } > > > > > > > > but it does not work, error: > > > > org.apache.tapestry.ioc.internal.util.TapestryException > > > > Failure reading parameter 'object' of component > admin/UserEdit:object: > > > > java.lang.String > > > > > > > > I have to do: > > > > > > > > public class UserEdit extends ObjectEdit <User> { > > > > public void onActivate(User obj) { > > > > this.setObject(obj); > > > > } > > > > } > > > > > > > > and remove the onActivate from ObjectEdit, why onActivate does not > work in a > > > > base class when onPassivate can? Thanks, > > > > > > > > A.C. > > > > > > > > > > > > -- > > > > View this message in context: > http://www.nabble.com/T5%3A-generic%2C-onActivate-and-onPassivate-tp16193600p16193600.html > > > > Sent from the Tapestry - User mailing list archive at Nabble.com. > > > > > > > > > > > > > --------------------------------------------------------------------- > > > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > > > For additional commands, e-mail: [EMAIL PROTECTED] > > > > > > > > > > > > > > > > > > > > -- > > > Howard M. Lewis Ship > > > > > > Creator Apache Tapestry and Apache HiveMind > > > > > > > > > > > > --------------------------------------------------------------------- > > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > > For additional commands, e-mail: [EMAIL PROTECTED] > > > > > > > > > > --------------------------------------------------------------------- > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > For additional commands, e-mail: [EMAIL PROTECTED] > > > > > > > > -- > Howard M. Lewis Ship > > Creator Apache Tapestry and Apache HiveMind > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]