class MessageUtil extends AbstractCaller {

    @Description("Finds the value of the target field for a message within the list, matching the specified field.<br/>" +
            "<b>fieldName</b> - the field name for the matching group.<br/>" +
            "<b>fieldValue</b> - the field value for the matching group.<br/>" +
            "<b>targetFieldName</b> – the target field name." +
            "<b>return</b> - the target field value.<br/>" +
            "Considering the above said, the final syntax is:<br/>" +
            "#{FindField(groups, fieldName, fieldValue, targetFieldName)}")
    @UtilityMethod
    public Object FindField(List<IMessage> groups, String fieldName, Object fieldValue, String targetFieldName) {
        IMessage msg = FindGroup(groups, fieldName, fieldValue);
        targetFieldName = targetFieldName != null ? targetFieldName.trim() : null;
        return msg.isFieldSet(targetFieldName) ? msg.getField(targetFieldName) : null;
    }

}