jav*_*top 2 java constructor dependency-injection instantiation jaxb
我需要在一个类被解组之后对它执行某些操作(在它由JAXB构建之后,而不是由我自己构建).
JAXB中有这样的功能吗?
如果没有,我怎么能实现它?
您可以使用'class defined'事件回调.在这里阅读更多http://java.sun.com/javase/6/docs/api/javax/xml/bind/Unmarshaller.html#unmarshalEventCallback
例如将此方法放在JAXB对象中:
//This method is called after all the properties (except IDREF) are unmarshalled for this object, //but before this object is set to the parent object. void afterUnmarshal( Unmarshaller u, Object parent ) { System.out.println( "After unmarshal: " + this.state ); }
归档时间: |
|
查看次数: |
1908 次 |
最近记录: |