java - How to get class reference for a generic class -
i new java (coming actionscript 3.0 background) , trying port actionscript code java (as3signals jsignal)
i trying class name of generic class in order pass super call.
in actionscript 3.0
super(vector.<tilevo>,boolean);
the above piece of code pass class references constructor vector of tilevo , boolean.
in java doesn't seem work , know doing wrong:
super(asvector.class<tilevo>,boolean.class);
to write short, how class reference asvector class composed of tilevo objects?
thank you!
later edit:
i realised code not displayed (treated html)
posting source code:
public signal(class<?>... params) { this.params = params; }
i need pass signal class references via constructor.
new signal(int.class)
example works
i need know how can pass signal's constructor class of object of form:
asvector<tilevo>
i tried asvector.class<tilevo>
, doesn't seem work!
at compile time, generic type parameters <tilevo>
in case undergo "erasure"; compiler converts usage of them implicit casts, information them discarded in bytecode. means api, there's no specific type asvector<tilevo>
, runtime type asvector
, , pass in asvector.class
. if it's necessary runtime handler know contents of asvector
tilevo
objects, you'll need pass in tilevo.class
parameter @ point in varargs.
Comments
Post a Comment