I have an interface called Model. It has a method called deserialize()
public interface Model
{
public void deserialize(String s);
}
There are many implementations of the Model interface.
I have a special class called Utilities that works on Model objects (i.e. implementations of the Model interface).
In Utilities, I have a function that takes a specified class, an creates a list of objects of that class.
public static <T extends Model> List<T> getList(StringReader reader, Class <T> theClass)
{
...
}
I have two classes A and B that both implement Model. In class A, I have the following code –
A
{
int x;
int y;
int z;
ArrayList<B> listOfBObjects;
public void deserialize(String dataString)
{
...
...
listOfBObjects = Utilities.getList(); <-- here I want to specify "B". How to do that?
}
}
How to specify “B” as an argument to the getList() function above?
But I answered this in your previous question…