/** * This will return a list of Pair objects, with each pair consiting of the <code>displayName * </code> of the field and its associated <code>value</code>. * * @param fieldGroup - An InputFieldGroup * @param command - The BeanWrapper instance wrapping {@link ReportDefinitionCommand} * @param exclusions - A list of <code>displayName</code> to be eliminated from the display. * @return List<Pair> objects. */ public List<Pair> fetchFieldValues( InputFieldGroup fieldGroup, BeanWrapper command, String... exclusions) { List<Pair> fieldList = new ArrayList<Pair>(); if (fieldGroup == null) return fieldList; for (InputField field : fieldGroup.getFields()) { if (exclusions != null && ArrayUtils.contains(exclusions, field.getDisplayName())) continue; fieldList.add(fetchFieldValue(field, command)); } return fieldList; }
public Pair fetchFieldValue(InputField field, BeanWrapper command) { Object value = command.getPropertyValue(field.getPropertyName()); String strValue = (value == null) ? null : String.valueOf(value); return new Pair(field.getDisplayName(), strValue); }