67,513
社区成员
发帖
与我相关
我的任务
分享
public abstract class Router {
@Autowired
Map<String,Decoder> decoders;
public void router(byte[] bytes) {
String type = getType(bytes);//自己去实现,
decoders.get(type).decode(bytes);
}
public abstract String getType(byte[] bytes);
}
public interface Decoder {
void decode(byte[] bytes);
}
@Component("A0")
public class A0Decoder implements Decoder{
@Override
public void decode(byte[] bytes) {
//xxx
}
}