On 5/22/07, Adam Winer <[EMAIL PROTECTED]> wrote:
The Trinidad subclass of LengthValidator needs some work.
Changes I plan to make - feedback appreciated:
- The messages are copied from the LongRangeValidator, so
we say "Enter a value greater than or equal to 5" instead
of "Enter a value of 5 or more characters". (I'll use the latter)
yup
- If min and max are the same, we don't have a custom message,
so you'd get something like "Enter a value between 5 and 5
characters". Looks silly. So, in addition to
LengthValidator.NOT_IN_RANGE, I'll add LengthValidator.EXACT.
indeed
- The override of Validate assumes the value is a Number!, and
lots of Javadoc is cut-and-pasted from LongRangeValidator,
it would seem... Thankfully, there's an instanceof check,
so no ClassCastExceptions but this code has to just be broken...
LongRangeVali ? or LengthVali (see subject)
the myfaces LengthVali does:
int length = value instanceof String ?
((String)value).length() : value.toString().length();
-- Adam
--
Matthias Wessendorf
further stuff:
blog: http://matthiaswessendorf.wordpress.com/
mail: matzew-at-apache-dot-org