*/
private static Messages createMessages(ModelNode messagesNode) {
Map<IField, List<Message>> messagesByField = new LinkedHashMap<IField, List<Message>>();
if (messagesNode.getType() == ModelType.LIST) {
for (ModelNode messageNode : messagesNode.asList()) {
Message message = createMessage(messageNode);
List<Message> messages = (List<Message>) messagesByField.get(message.getField());
if (messages == null) {
messages = new ArrayList<Message>();
}
messages.add(message);
messagesByField.put(message.getField(), messages);
}
}
return new Messages(messagesByField);
}