public enum ProcessorFactory {
A("ap") {
Processor create() throws Exception {
return new AProcessor();
}
},
B("bp"){
Processor create() throws Exception {
return new BProcessor();
}
};
abstract Processor create() throws Exception;
public static Processor getProcessor(String product) throws Exception {
ProcessorFactory factory = valueOf(product);
return factory.create();
}
private String product;
private ProcessorFactory(String product) {
this.product = product;
}
}
今電話しようとすると
ProcessorFactory.getProcessor("ap");
上記の例外がスローされます。何か案は?