I'm trying to create some kind of a message handler.
I will receive JSON with structure like this:
{
"data": {"Increase_A":1.5, "Increase_B":2},
"some_string": "blablabla"
}
I want to create message object in java to properly handle them.
public class Message{
private updateField[] updateFields;
private String some_string;
public enum updateField{
INCREASE_A, INCREASE_B, OTHER_ACTION;
}
public Message(updateField[] updateFields, String some_string){
this.updateFields = updateFields;
this.some_string = some_string;
}
}
When I will receive string/json message I want to convert it to Message object.
The thing I don't know how to do is how to restrict Increase_A to integer type and Increase_B to double type. The message can contain one or more updateFields.