@XmlRootElement(name="interfaceContainer")
public class InterfaceContainer {
//接口名
private String interfaceName;
//接口方法
private List methods;
//接口描述
private String comment;
//接口创建人
private String creator;
//接口创建时间
private Date createDate;
//接口修改人
private String modifier;
//修改时间
private Date updateDate;
//生成时间
private Date generatedDate;
//状态
private int state;
//get set
@XmlElement
public String getInterfaceName() {
return interfaceName;
}
public void setInterfaceName(String interfaceName) {
this.interfaceName = interfaceName;
}
@XmlElementWrapper(name = "methods")
@XmlElement(name = "method")
public List<MethodContainer> getMethods() {
return methods;
}
public void setMethods(List<MethodContainer> methods) {
this.methods = methods;
}
@XmlElement
public String getComment() {
return comment;
}
public void setComment(String comment) {
this.comment = comment;
}
@XmlElement
public String getCreator() {
return creator;
}
public void setCreator(String creator) {
this.creator = creator;
}
@XmlElement
public Date getCreateDate() {
return createDate;
}
public void setCreateDate(Date createDate) {
this.createDate = createDate;
}
@XmlElement
public String getModifier() {
return modifier;
}
public void setModifier(String modifier) {
this.modifier = modifier;
}
@XmlElement
public Date getUpdateDate() {
return updateDate;
}
public void setUpdateDate(Date updateDate) {
this.updateDate = updateDate;
}
@XmlElement
public Date getGeneratedDate() {
return generatedDate;
}
public void setGeneratedDate(Date generatedDate) {
this.generatedDate = generatedDate;
}
@XmlElement
public int getState() {
return state;
}
public void setState(int state) {
this.state = state;
}
这个是最外层的对象,
public class MethodContainer {
//方法名称
private String methodName;
//方法参数
private List param;
//方法返回值
private ParamMethod returned;
//方法修饰词
private String decorated;
//方法体
private String methodBody;
//get set方法
@XmlElement
public String getMethodName() {
return methodName;
}
public void setMethodName(String methodName) {
this.methodName = methodName;
}
@XmlElementWrapper(name = "params")
@XmlElement(name = "param")
public List getParam() {
return param;
}
public void setParam(List param) {
this.param = param;
}
@XmlElement
public String getDecorated() {
return decorated;
}
public void setDecorated(String decorated) {
this.decorated = decorated;
}
@XmlElement
public ParamMethod getReturned() {
return returned;
}
public void setReturned(ParamMethod returned) {
this.returned = returned;
}
@XmlElement
public String getMethodBody() {
return methodBody;
}
public void setMethodBody(String methodBody) {
this.methodBody = methodBody;
}
这个是中间对象
@XmlRootElement(name="interfaceContainer")
public class ParamMethod {
//参数类型
private String paramClazz;
//参数名
private String paramName;
//get set
@XmlElement
public String getParamClazz() {
return paramClazz;
}
public void setParamClazz(String paramClazz) {
this.paramClazz = paramClazz;
}
@XmlElement
public String getParamName() {
return paramName;
}
public void setParamName(String paramName) {
this.paramName = paramName;
}
这个是底层对象 ,
java.lang.ClassCastException: com.entity.ParamMethod cannot be cast to com.entity.InterfaceContainer
这个是异常