首先抱歉我的英语不好。我想要解组,而不是编组以下课程。
@XmlSeeAlso({B1.class, C1.class})
public abstract class A1 implements Serializable {
private String parameterName;
public A1 () {
}
public A1 (String parameterName) {
this.parameterName = parameterName;
}
public String getParameterName() {
return parameterName;
}
}
子类
public class B1 extends A1{
@SuppressWarnings("rawtypes")
private Collection dataSource = new ArrayList();
public B1 () {
}
@SuppressWarnings("rawtypes")
public B1 (String parameterName, Collection dataSource) {
super(parameterName);
this.dataSource = dataSource;
}
@SuppressWarnings("rawtypes")
public B1 (Collection dataSource) {
super("B");
this.dataSource = dataSource;
}
@SuppressWarnings("rawtypes")
public Collection getDataSource() {
return dataSource;
}
和
public class C1 extends A1 {
private String imagePath;
public C1() {
}
protected C1(String parameterName) {
super(parameterName);
}
public C1 (String parameterName, String imagePath) {
super(parameterName);
this.imagePath = imagePath;
}
public String getImagePath() {
return imagePath;
}
子类在集合
中List<? extends A1>
解组和编组后,fieds将为null(例如:parameterName)。该应用程序不会抛出任何异常。