Wednesday, 28 August 2013

How to get class reference for a generic class

How to get class reference for a generic class

I am new to java (coming from an Actionscript 3.0 background) and I am
trying to port some actionscript code to java (as3signals to jsignal)
I am trying to get the class name of a generic class in order to pass it
to a super call.
In Actionscript 3.0 this would be
super(Vector.<TileVO>,Boolean);
The above piece of code would pass the class references to the constructor
for the Vector of TileVO and Boolean.
In Java this doesn't seem to work and I know I am doing something wrong:
super(ASVector.class<TileVO>,boolean.class);
To write it short, how do you get the class reference for an ASVector
class composed of TileVO objects?
Thank you!
Later Edit:
I just realised that code was not displayed properly (treated as html)
Posting some source code:
public Signal(Class<?>... params) {
this.params = params;
}
I need to pass to the Signal class references via the constructor.
new Signal(int.class) for example works
I need to know how can I pass to Signal's constructor the class of an
object of this form:
ASVector<TileVO>
I tried ASVector.class<TileVO> and it doesn't seem to work!

No comments:

Post a Comment