/** * Create a clone of this GoalStatus. */ @Override public GoalStatus clone() { return new GoalStatus(this.goalID, this.status, this.text); }
/** * Create a new GoalStatus based on the given Message. Any missing values * will be set to their defaults. * * @param m * The Message to parse. * @return A GoalStatus message based on the given Message. */ public static GoalStatus fromMessage(Message m) { // get it from the JSON object return GoalStatus.fromJsonObject(m.toJsonObject()); }
/** * Create a new GoalStatus based on the given JSON string. Any missing * values will be set to their defaults. * * @param jsonString * The JSON string to parse. * @return A GoalStatus message based on the given JSON string. */ public static GoalStatus fromJsonString(String jsonString) { // convert to a message return GoalStatus.fromMessage(new Message(jsonString)); }
@Override public void handleStatus(GoalStatus status) { this.status = GoalStatusEnum.values()[status.getStatus()]; if (cb != null) { cb.handleStatus(status); } }
/** * Create a new GoalStatus based on the given Message. Any missing values * will be set to their defaults. * * @param m * The Message to parse. * @return A GoalStatus message based on the given Message. */ public static GoalStatus fromMessage(Message m) { // get it from the JSON object return GoalStatus.fromJsonObject(m.toJsonObject()); }
/** * Create a clone of this GoalStatus. */ @Override public GoalStatus clone() { return new GoalStatus(this.goalID, this.status, this.text); }
/** * Create a new GoalStatus based on the given JSON string. Any missing * values will be set to their defaults. * * @param jsonString * The JSON string to parse. * @return A GoalStatus message based on the given JSON string. */ public static GoalStatus fromJsonString(String jsonString) { // convert to a message return GoalStatus.fromMessage(new Message(jsonString)); }
@Override public void handleMessage(Message message) { JsonArray statusList = message.toJsonObject().getJsonArray("status_list"); statusList.forEach(status -> { String goalId = ((JsonObject)status).getJsonObject("goal_id").getString("id"); if (goals.containsKey(goalId)) { ActionCallback cb = goals.get(goalId); cb.handleStatus(GoalStatus.fromJsonObject((JsonObject)status)); } }); } });
/** * Create a new GoalStatus based on the given JSON object. Any missing * values will be set to their defaults. * * @param jsonObject * The JSON object to parse. * @return A GoalStatus message based on the given JSON object. */ public static GoalStatus fromJsonObject(JsonObject jsonObject) { // check the fields GoalID goalID = jsonObject.containsKey(GoalStatus.FIELD_GOAL_ID) ? GoalID .fromJsonObject(jsonObject .getJsonObject(GoalStatus.FIELD_GOAL_ID)) : new GoalID(); byte status = jsonObject.containsKey(GoalStatus.FIELD_STATUS) ? Primitive .toUInt8((short) jsonObject.getInt(GoalStatus.FIELD_STATUS)) : 0; String text = jsonObject.containsKey(GoalStatus.FIELD_TEXT) ? jsonObject .getString(GoalStatus.FIELD_TEXT) : ""; return new GoalStatus(goalID, status, text); } }
@Override public void handleMessage(Message message) { String goalId = message.toJsonObject().getJsonObject("status").getJsonObject("goal_id").getString("id"); if (goals.containsKey(goalId)) { ActionCallback cb = goals.get(goalId); cb.handleStatus(GoalStatus.fromJsonObject(message.toJsonObject().getJsonObject("status"))); cb.handleFeedback(message.toJsonObject().getJsonObject("feedback")); } } });
/** * Create a new GoalStatus based on the given JSON object. Any missing * values will be set to their defaults. * * @param jsonObject * The JSON object to parse. * @return A GoalStatus message based on the given JSON object. */ public static GoalStatus fromJsonObject(JsonObject jsonObject) { // check the fields GoalID goalID = jsonObject.containsKey(GoalStatus.FIELD_GOAL_ID) ? GoalID .fromJsonObject(jsonObject .getJsonObject(GoalStatus.FIELD_GOAL_ID)) : new GoalID(); byte status = jsonObject.containsKey(GoalStatus.FIELD_STATUS) ? Primitive .toUInt8((short) jsonObject.getInt(GoalStatus.FIELD_STATUS)) : 0; String text = jsonObject.containsKey(GoalStatus.FIELD_TEXT) ? jsonObject .getString(GoalStatus.FIELD_TEXT) : ""; return new GoalStatus(goalID, status, text); } }
@Override public void handleMessage(Message message) { String goalId = message.toJsonObject().getJsonObject("status").getJsonObject("goal_id").getString("id"); if (goals.containsKey(goalId)) { ActionCallback cb = goals.get(goalId); cb.handleStatus(GoalStatus.fromJsonObject(message.toJsonObject().getJsonObject("status"))); cb.handleResult(message.toJsonObject().getJsonObject("result")); } } });
statuses[i] = GoalStatus.fromJsonObject(jsonPoses .getJsonObject(i));
statuses[i] = GoalStatus.fromJsonObject(jsonPoses .getJsonObject(i));