[ 
http://issues.ops4j.org/browse/QI-153?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13677#action_13677
 ] 

Niclas Hedhman commented on QI-153:
-----------------------------------

I would like to get working on this.

We already have introduced the basic Specification concept, and now need to 
extend it to be used for automatic invariant support in Entities. My guess is 
that UnitOfWorkCallback can be used, and in that case we could put all of the 
things below in a library instead of qi4j-core.

Proposal;

1. Introduce a new interface

public interface InvariantValidation<T> extends UnitOfWorkCallback
{
    Property<Specification<T>> invariantSpecification();
}


2. Provide a UoW callback implementation that simply pick up the 
invariantSpecification and calls the satisfiedBy() method with itself as the 
argument.

3. Change UnitOfWork to support ConstraintViolationException, so that every 
Entity will be called beforeCompletion() for a chance of validation, the 
violations aggregated and thrown out of the UnitOfWork as a collection.




> Specification from DDD
> ----------------------
>
>                 Key: QI-153
>                 URL: http://issues.ops4j.org/browse/QI-153
>             Project: Qi4j
>          Issue Type: New Feature
>            Reporter: Niclas Hedhman
>            Assignee: Niclas Hedhman
>
> Eric Evans speaks of Specification as a cross-object contract that must be 
> valid at all times (minus transitions). He goes on to describe that the 
> Specification can then be used for other purposes, such as in Unit tests.

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

        

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

Reply via email to