mirror of
https://github.com/AsamK/signal-cli
synced 2025-09-02 12:30:39 +00:00
added generic data object
This commit is contained in:
parent
78b968f0d3
commit
a29e34f2c6
1 changed files with 13 additions and 1 deletions
|
@ -21,6 +21,7 @@ public class JsonEvtLoopStatusReport {
|
||||||
public String status;
|
public String status;
|
||||||
public String message;
|
public String message;
|
||||||
public JsonMessageEnvelope envelope;
|
public JsonMessageEnvelope envelope;
|
||||||
|
public JsonNode data;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -35,6 +36,13 @@ public class JsonEvtLoopStatusReport {
|
||||||
this.reqID = null;
|
this.reqID = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public JsonEvtLoopStatusReport( String respType, JsonNode reqID, JsonNode data) {
|
||||||
|
this.respType = respType;
|
||||||
|
this.status = "ok";
|
||||||
|
this.reqID = reqID;
|
||||||
|
this.data = data;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates new JsonEvtLoopStatusReport object to use for responding to requests
|
* Creates new JsonEvtLoopStatusReport object to use for responding to requests
|
||||||
*
|
*
|
||||||
|
@ -70,7 +78,11 @@ public class JsonEvtLoopStatusReport {
|
||||||
ObjectMapper mpr = new ObjectMapper();
|
ObjectMapper mpr = new ObjectMapper();
|
||||||
mpr.setVisibility( PropertyAccessor.FIELD, Visibility.ANY);
|
mpr.setVisibility( PropertyAccessor.FIELD, Visibility.ANY);
|
||||||
try {
|
try {
|
||||||
System.out.println( mpr.writeValueAsString(this));
|
//System.out.println( mpr.writeValueAsString(this));
|
||||||
|
JsonNode n = mpr.valueToTree(this);
|
||||||
|
System.out.println( mpr.writeValueAsString(n));
|
||||||
|
} catch( IllegalArgumentException e) {
|
||||||
|
System.err.println( "JsonEvtLoopStatusReport: ERROR: Failed to serialize object: " + e.toString());
|
||||||
} catch( JsonProcessingException e) {
|
} catch( JsonProcessingException e) {
|
||||||
System.err.println( "JsonEvtLoopStatusReport: ERROR: Failed to serialize object: " + e.toString());
|
System.err.println( "JsonEvtLoopStatusReport: ERROR: Failed to serialize object: " + e.toString());
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue