我的来源:
private static HashMap<String, Class<?>> mapLogic = new HashMap<String,Class<?>>();
mapLogic.put("s", Packet1.class);
mapLogic.put("a", Packet2.class);
public abstract class Packet {
public abstract void get(ChannelBuffer buffer);
public abstract void send(ChannelBuffer buffer);
}
和
public class Packet1 extends Packet{
@Override
public void get(ChannelBuffer buffer) {
}
@Override
public void send(ChannelBuffer buffer) {
}
}
public class Packet2 extends Packet{
@Override
public void get(ChannelBuffer buffer) {
}
@Override
public void send(ChannelBuffer buffer) {
}
}
mapLogic.get("s").newInstance().get()
<--- 获取或发送不可用
我怎样才能得到这些方法?