Re: [JBoss-user] reflection with entity beans?

2001-10-22 Thread Fred Loney

import java.beans.PropertyDescriptor;
import java.lang.reflect.Method;

public set(String prop, Object value) {
PropertyDescriptor propDesc = new PropertyDescriptor(prop,
getClass());
Method mutator = propDesc.getWriteMethod();
Object[] args = { value };
mutator.invoke(this, args);
}

Fred Loney
Spirited Software, Inc.
www.spiritedsw.com


- Original Message -
From: "Frank Morton" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, October 22, 2001 1:24 PM
Subject: [JBoss-user] reflection with entity beans?


> If I have an CMP entity bean with a field named "name"
> and corresponding methods setName() and getName(),
> is there a way to use reflection to have the same affect
> as setName() given the name of the field? In other
> words, I'd like to have a general method set() that takes
> the name of the field and the value to set it to, so:
>
> setName("frank");
>
> would be the same thing as:
>
> set("Name","frank");
>
> Can someone point me specifically to somewhere describing
> how to do this? Thanks.
>
>
>
> ___
> JBoss-user mailing list
> [EMAIL PROTECTED]
> https://lists.sourceforge.net/lists/listinfo/jboss-user
>


___
JBoss-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-user



[JBoss-user] reflection with entity beans?

2001-10-22 Thread Frank Morton

If I have an CMP entity bean with a field named "name"
and corresponding methods setName() and getName(),
is there a way to use reflection to have the same affect
as setName() given the name of the field? In other
words, I'd like to have a general method set() that takes
the name of the field and the value to set it to, so:

setName("frank");

would be the same thing as:

set("Name","frank");

Can someone point me specifically to somewhere describing
how to do this? Thanks.



___
JBoss-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-user