xml样例:
String
xml1
=
“<RESPONSE><
ERRORINFO
></ERRORINFO><
RETINFO
><
FRUITS
><
FRUIT
><Name>apple</Name></
FRUIT
><
FRUIT
><Name>banana</Name></
FRUIT>
</
FRUITS
></
RETINFO
>
</RESPONSE>”
;
被抽象的xml内容体:
public
interface
RETINFO {
}
接收xml的泛型对象:
@XStreamAlias
(
"RESPONSE"
)
public
class
Response <T extends RETINFO>{
@XStreamAlias
(
"ERRORINFO"
)
private
ErrorInfo
errorInfo
;
@XStreamAlias
(
"RETINFO"
)
private
T
retInfo
;
//getter/setter
}
泛型的实现类
@XStreamAlias
(
"RETINFO