Hi,
I've created a generic:
public class SheetParameter<T> {
private T value;
public SheetParameter(T value)
{
this.value = value;
}
public void set(T value)
{
this.value = value;
}
public T get()
{
return this.value;
}
}
here I want T to be off any type to be determined when I create it, I
then create it:
sheets.add(buildSheet(new SheetParameter<String>("lalalala")));
so then T is of type String. I then need to pass that type to the
buildSheet method that I declared as:
protected <T> ReportSheet buildSheet(SheetParameter<T> sheetParameter)
throws Exception
but when i call get() method its of type T and is unknown, I must then
cast it to String. Am I doing something wrong? How can I change the
buildSheet method above where it must take the type of the
SheetParameter that I created (in this case the type is String). The
idea is that the method above is in an abstract class so can be
overridden and then you can pass any SheetParameter type to it.
Thanks
Lennie De Villiers
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---