note description: "Status message, includes a possible failure string." author: "Patrick Ruckstuhl " date: "$Date$" revision: "$Revision$" class A_GENERAL_STATUS_MESSAGE inherit A_GENERAL_MESSAGE rename make as make_message redefine handle end create make create {A_MESSAGE_FACTORY} make_from_ems_message feature {NONE} -- Initialization make (a_success: like is_success; a_message: like message) -- Create with a success status and a message. require no_success_implies_message: not a_success.value implies a_message /= Void and then not a_message.is_empty do make_message is_success := a_success if a_message /= Void then message := a_message else create message.make ("") end end feature -- Message handling handle (a_handler: A_GENERAL_STATUS_MESSAGE_HANDLER) -- do a_handler.handle_general_status (Current) end feature -- Access type: STRING -- Type of the message. once Result := general_status_type end is_success: A_BOOLEAN_VALUE -- Successful? message: A_STRING_VALUE -- Status message. feature {NONE} -- Implementation is_success_argument: STRING = "success" message_argument: STRING = "failure" serialization_list: attached STRING -- Lists the fields to serialize, and under which name do create Result.make_empty Result.append ("%"" + is_success_argument + "%":") Result.append (is_success.serialize) Result.append (",") Result.append ("%"" + message_argument + "%":") Result.append (message.serialize) end parse_tag (a_tag: STRING; a_tokenizer: A_JSON_TOKENIZER) do if a_tag.is_equal (is_success_argument) then create is_success.make_from_tokenizer (a_tokenizer) elseif a_tag.is_equal (message_argument) then create message.make_from_tokenizer (a_tokenizer) end end invariant message_set: message /= Void no_success_implies_message: not is_success.value implies not message.is_empty end