Niclas Hedhman wrote:
> Gang,
> 
> Constraints on in-arguments is pretty cool and extremely useful. But,
> should we perhaps even support a "Contract" on return values? So, that
> the client can rest assure (via tools eventually) that certain things
> can't happen (Null returns, negative values, whatever)

I can't think of any good reason not to do it, now that we have a pretty 
good framework for implementing it. I'm assuming that it would look 
something like:

@NotEmpty @Matches("[A-Z][a-z]*")
public String helloWorld(@NotNull String phrase, @NotNull String name);

One question is what should happen if an incorrect value is created? The 
current ConstraintViolationException extends IllegalArgumentException 
which doesn't seem to make sense. What exactly would the semantics be, 
and what should you do with the exception if you get it?

/Rickard

_______________________________________________
qi4j-dev mailing list
[email protected]
http://lists.ops4j.org/mailman/listinfo/qi4j-dev

Reply via email to