DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT <http://nagoya.apache.org/bugzilla/show_bug.cgi?id=25991>. ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND INSERTED IN THE BUG DATABASE.
http://nagoya.apache.org/bugzilla/show_bug.cgi?id=25991 Validate a single field Summary: Validate a single field Product: Commons Version: unspecified Platform: Other OS/Version: Other Status: NEW Severity: Enhancement Priority: Other Component: Validator AssignedTo: [EMAIL PROTECTED] ReportedBy: [EMAIL PROTECTED] We are using the validator framework for a Swing application and need to be able to validate a single field on the bean (our Model). It is too expensive to validate the entire bean every time when we only care about a single field (for example validating a filed when it loses focus). What I need is a new validate method on the Validator class that takes the field name as an argument and returns a ValidatorResult. I can't extend the Validator class and write my own because the validateField method is private. The two solutions I have thought of are to either add a validate method on the Validator class, or to make the validateField method protected (or protected final) instead of private (so I can do what I need in a subclass). Here is a possible implementation of the new validate (mostly a cut and paste from the existing method)to give you an idea what I need: public ValidatorResult validate(String fieldName) throws ValidatorException { ValidatorResults results = new ValidatorResults(); Locale locale = (Locale) this.getParameterValue(LOCALE_PARAM); if (locale == null) { locale = Locale.getDefault(); } this.setParameter(VALIDATOR_PARAM, this); Form form = this.resources.getForm(locale, this.formName); if (form != null) { Field field = form.getField(fieldName); if (field == null) { throw new ValidatorException("Unable to validate Field " + fieldName + ". Field not found."); } if ((field.getPage() <= page) && (field.getDepends() != null)) { this.validateField(field, results); } } return results.getValidatorResult(fieldName); } --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
