This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Java in General and the fly likes java beans propertyDescrptor Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "java beans propertyDescrptor" Watch "java beans propertyDescrptor" New topic
Author

java beans propertyDescrptor

mark I thomas
Ranch Hand

Joined: Apr 07, 2008
Posts: 86
I have code like following




It turns out that for the "enrollDay" field , the "PropertyDescriptor " can NOT find its write method. For the rest of fields, it has no problem in terms of converting the string inot int, etc. So is it true that , in order to make this work, you can only do straightford setter method without any twisting around it ?

Steve Luke
Bartender

Joined: Jan 28, 2003
Posts: 4167
    
  21

Can you be more specific about the problem you are having? Also a real compilable example would help demonstrate the problem.

Is the problem because you have a different return type for the getter than you have parameter for the setter (can't tell, you conveniently left off the return types for your methods)?

The method pair for a property, of type T must be:

It does not matter what the value is stored as in the bean - the Introspector uses methods to determine Bean properties. My guess is that you messed up one of the method signatures. You can get around this requirement (I think) by writing your own BeanInfo class which knows what methods to call...


Steve
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: java beans propertyDescrptor
 
Similar Threads
Fill bean data from HashMap using Reflection
Unknown error with JDBC code or with driver.
merging data values of two similar objects
dynamic class loading and generics
Removing Hibernate Completely From POJO