I'm trying to implement
Hashtable<string, -Typeof one Class->
in java. But I do not know how to do this. I tried
Hashtable<String, AbstractRestCommand.class>
but it seems wrong.
Btw. I want this to create a new instance of the class to reflect at runtime.
So my question is: how to do this?
Edit:
I have an abstract class "AbstractRestCommand". Now I would like to create a Hashtable with many such commands:
Commands.put("PUT", -PutCommand-);
Commands.put("DELETE", -DeleteCommand-);
where PutCommand and DeleteCommand extend AbstractRestCommand, so I can create a new instance with
String com = "PUT"
AbstractRestCommand command = Commands[com].forName().newInstance();
...
source
share