问题
I've few of Java Enums which needs to mapped. I implement a XmlAdapter for marshalling and unmarshalling purpose.
I would like to make the enums generic that I can call similar method of the enums from XmlAdapter. I also introduced an interface where all the enums implementing them.
@XmlJavaAdapter(MyAdapter.class)
public enum A implements Hello {
doSomething1();
doSomething2();
}
@XmlJavaAdapter(MyAdapter.class)
public enum B implements Hello {
doSomething1();
doSomething2();
}
MyAdapter extends XmlAdapter<String, Enum> {
Enum unmarshal(String s){
// I would like to return the correct enum from the Enums those who sharing this adapter
}
}
Any idea? Thanks
来源:https://stackoverflow.com/questions/31006981/java-xmladapter-is-it-possible-to-find-out-which-enums-are-using-that-adapter