On Mon, Dec 1, 2008 at 6:17 PM, Emily Crutcher <[EMAIL PROTECTED]> wrote:

> Unfortunately, it is not very easy to change the contract after we've
> released it into the wild.  We can go with either solution, as both have
> their plusses and minuses, but I'm not sure we can change course in the
> middle.
>

How about:

public interface HasValue<T> {
  T getValue();
  boolean isAcceptableValue(T v);
  void setValue(T v) throws InvalidArgumentException;
}

If you want to check if a given widget will accept a particular value, you
can ask without having to do a set and catch an exception, plus you don't
have to worry if it transformed the value to something else as below.
Otherwise, if you call setValue it is free to mangle it into some supported
value (for example, null => "" for a text box, invalid date => today, etc)
or throw an exception if it can't reasonably do so, but that behavior would
be entirely up to the widget.  I do agree it should not be a checked
exception.

-- 
John A. Tamplin
Software Engineer (GWT), Google

--~--~---------~--~----~------------~-------~--~----~
http://groups.google.com/group/Google-Web-Toolkit-Contributors
-~----------~----~----~----~------~----~------~--~---

Reply via email to