使用Object解决泛型问题

This commit is contained in:
free will committed 2021-05-17 15:17:05 +08:00
1 parent 0d59c19330
commit 490d115ff5
2 files changed
+18 -13

No files matched your search

+13 -12
View File
@@ -37,12 +37,13 @@ public class ControlResponse {
// 信息
@JsonProperty("Msg")
public String msg;
// 数据
public class ControlResponseData<E>{
public E value;
}
// // 数据
// public class ControlResponseData<E>{
// public E value;
// }
// public ControlResponseData data=new ControlResponseData();
@JsonProperty("Data")
public ControlResponseData data=new ControlResponseData();
public Object data;
public ControlResponse(){
}
@@ -51,7 +52,7 @@ public class ControlResponse {
this.type=response.type;
this.code=response.code;
this.msg=response.msg;
this.data.value=response.data.value;
this.data=response.data;
}
/**
@@ -59,7 +60,7 @@ public class ControlResponse {
* @return
*/
public String getString(){
return (String) this.data.value;
return (String) this.data;
}
/**
@@ -68,7 +69,7 @@ public class ControlResponse {
*/
public void setString(String str){
this.type=ControlResponseTypeString;
this.data.value=str;
this.data=str;
}
/**
@@ -76,7 +77,7 @@ public class ControlResponse {
* @return
*/
public ControlResponseMeta getMeta(){
return (ControlResponseMeta) this.data.value;
return (ControlResponseMeta) this.data;
}
/**
@@ -85,7 +86,7 @@ public class ControlResponse {
*/
public void setMeta(ControlResponseMeta meta){
this.type=ControlResponseTypeMeta;
this.data.value=meta;
this.data=meta;
}
/**
@@ -93,7 +94,7 @@ public class ControlResponse {
* @return
*/
public byte[] getBytes(){
return (byte[]) this.data.value;
return (byte[]) this.data;
}
/**
@@ -102,7 +103,7 @@ public class ControlResponse {
*/
public void setBytes(byte[] bytes){
this.type=ControlResponseTypeBytes;
this.data.value=bytes;
this.data=bytes;
}
/**