i don't know english, so i show you with example:
<foo>
<action name="exec" pid="1"> <!-- unfortunately I can't use "xsi:type" here
-->
<process-name value=""/>
</action>
</foo>
<foo>
<action name="move" file="foo.txt"> <!-- unfortunately I can't use
"xsi:type" here -->
<to dir="../"/>
</action>
</foo>
public class ActionType {
protected String name;
}
public class ActionExecType extends ActionType {
...
}
public class ActionMoveType extends ActionType {
...
}
//For me it had to go, but no go
JAXBElement<FooType> foo = unmarshaller.unmarshal(xml, "package with all
jaxb type classes");
if( foo.getActionType().getName().equals("exec") ) {
ActionExecType action = (ActionExecType) foo.getActionType();
action.getProcessName();
} else if ( foo.getActionType().getName().equals("move") ) {
ActionMoveType action = (ActionMoveType) foo.getActionType();
action.getTo();
}
thanks.
--
View this message in context: http://www.nabble.com/how-use-inheritance-without-xsi%3Atype.-tp23986762p23986762.html
Sent from the java.net - jaxb users mailing list archive at Nabble.com.