try {
Object values = PropertyUtils.getProperty(bean, field.getProperty());
int minChoices = Integer.parseInt(field.getVarValue("minChoices"));
if (!(values == null)) {
int numChoices = 0;
if (values instanceof Object[]) {
numChoices = ((Object[])values).length;
}
else if (values instanceof Collection) {
numChoices = ((Collection) values).size();
}
else {
errors.add(field.getKey(),
Resources.getActionMessage(request, va, field));
return false;
}
if (numChoices < minChoices) {
errors.add(field.getKey(),
Resources.getActionMessage(request, va, field));
return false;
}
}
}
catch (Exception e) {
errors.add(field.getKey(),
Resources.getActionMessage(request, va, field));
return false;
}
return true;