Making isEmpty() in AbstarctField public?

I feel that isEmpty() is useful for others to invoke when they are using the Fields outside the Form component.

Also, my feeling is that it should be part of the Field interface.

Any comments?

I guess there wouldn’t be any harm in that, as it is just a helper method. R’n’D just wants to have some of the api closed, as opening them means that maintainability goes down.

On the other hand,
field.isEmpty() is equivalent to (field.getValue()==null). Can you use that?

field.isEmpty() is not always field.getValue() == null (Example: TextField). Also, I have CustomField (class extended from AbstractField), that behaves differently.

I have sometimes solved this isEmpty issue using a simple static function like:

static public boolean isEmpty(Field f) {
    Object value = f.getValue();
    return value == null || "".equals(value.toString().trim());

This also treats Strings containing only blanks as empty.