Lennie De Villiers wrote:
> I've created a generic:
> public class SheetParameter<T> {
...
> }
Maybe I'm being a bit dim here this morning ("coffee wanted" state)...
It is not clear to me what you're trying to achieve. Are you trying to
have a ReportSheet object that stores ALL SheetParameters in a single
ReportSheet, but only returns the appropriately-typed SheetParameters
from buildSheet()? Or are you aiming to have separate type-parameterised
ReportSheet objects (presumably on ReportSheet container per
type-of-SheetParameter? (Or something else and I've completely missed
the point? ;-)
> so then T is of type String. I then need to pass that type to the
> buildSheet method that I declared as:
Remember that T is compile-time-only information; if you want to keep
the type information hanging about at runtime, then you need to do the
housekeeping. Generics as currently specified won't do it for you!
> protected <T> ReportSheet buildSheet(SheetParameter<T> sheetParameter)
> throws Exception
Would there be any problem with redeclaring that method as
<T> ReportSheet buildSheet( SheetParam<T> p, Class<T> type )...?
(Though you might want to type-parameterise ReportSheet as well.)
--
mike morris :: mikro2nd (at) gmail (dot) com
http://mikro2nd.net/
http://mikro2nd.net/blog/planb/
http://mikro2nd.net/blog/mike/
This email is [X]bloggable [ ]ask-first [ ]private
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"CTJUG Tech" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.co.za/group/CTJUG-Tech?hl=en
-~----------~----~----~----~------~----~------~--~---