Functionality to Implement:
Implement the serialization method for the HelloMessage class that extends the WampMessage. This method should convert a HelloMessage object into a JSON representation suitable for transmission over a protocol.
Input/Output Requirements:
Input: A HelloMessage object which contains:
A String representing the realm.
A List<WampRole> containing roles associated with the message.
Output: A JSON representation of the HelloMessage object. The JSON should include:
An attribute "realm" with its corresponding value.
An attribute "roles" containing a list of the role names and their associated features. Each role should include its name and a map of boolean features.
Implementation Steps:
Create a method serialize(JsonGenerator generator) in the HelloMessage class.
Use the JsonGenerator to write the JSON object.
Ensure proper handling of the realm and roles list, converting them to the expected JSON format.
Test the serialization method to ensure it accurately represents the HelloMessage structure.
Location for Implementation: Place the solution in the /app/ directory of the project.