[jbossseam-issues] [JBoss JIRA] Commented: (JBSEAM-356) Session bean assertions

Vladimir Ralev (JIRA) jira-events at lists.jboss.org
Wed Apr 18 11:41:30 EDT 2007


    [ http://jira.jboss.com/jira/browse/JBSEAM-356?page=comments#action_12359742 ] 
            
Vladimir Ralev commented on JBSEAM-356:
---------------------------------------

Hi Gavin.

I am looking at this task and there are a few things:

1. Do you think these conditions should be checked after injection (this also makes sense), or immediately after the postconstruct/aroundinvoke?
2. The hibernate validator annotations are can't be bound to method params. Did you mean to fork the hibernate validator in the seam project (say seam.validator)?
3. Method return value check annotation is ambigious - two cases:

@NotNull String getSomething() // getters represent the object state and should be checked (and invoked) on each method call and postconstruct
@NotNull String doSomething() // "doers" should be checked only when they are actually invoked

May be using some heuristics to branch based on ( methodName.beginsWith("get") || methodName.beginsWith("is") ) , but that's not very reliable because someone may still code side-effects in a getter.

I have implemented the postconstruct/aroundinvoke version using the orignal hibernate validator, which would work fine unless you really the method param validation.

> Session bean assertions
> -----------------------
>
>                 Key: JBSEAM-356
>                 URL: http://jira.jboss.com/jira/browse/JBSEAM-356
>             Project: JBoss Seam
>          Issue Type: Feature Request
>          Components: Core
>            Reporter: Gavin King
>
> For people who like more of a design-by-contract style, we could let you specify Hibernate Validator annotations on the session bean, and check them after @PostConstruct and before and after each business method.
> eg.
> @Stateful
> public class Foo {
>     @NotNull private Bar bar;
>     @Min(0) int count;
> }

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.jboss.com/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        



More information about the seam-issues mailing list