What should get method return types be??
"Rick Reumann" <[email protected]> Mon, 12 May 2003 01:56:47 -0400
| Newsgroups | gmane.comp.java.mvc.devel |
|---|---|
| Organization | baseBeans Engineering |
| Message-ID | <[email protected]> |
I haven't tried to compile the latest BasicPortal code, but I'm confused how you aren't getting compile errors since it looks like all of the get methods return type String yet the getValue(String s) method called in each getter looks like it returns type Object (signature in BaseBean), yet I do not see a conversion to String being done anywhere. Should the return types in the BaseBean subclasses be type Object instead of String? (I understand all the setters should be String). I'm trying to best figure out how to handle different data types that could be set in my LabelValueBean. Since this is going to be a generic bean that will handle different sql result queries the methods could return possibly different datatypes (Integer, Double, etc). The easiest (and it seems to work fine) is to simply return type Object for the getters. The JSP tags seem to handle type Object ok (I'm assuming they are just applying toString() method to the Object). Not sure on "best practice", though. Thanks, -- Rick