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

Niclas Hedhman commented on QI-330:
-----------------------------------

They are used outside Qi4j.

GutFeeling(tm) also tells me that there are more complex cases;

 - Subtype must be oneOf....
 - Don't allow these types to reside in Application Layer.

(I like constraints, like "You are not allowed to buy guns", to save me from 
myself ;-) )

> Constraining subtypes
> ---------------------
>
>                 Key: QI-330
>                 URL: http://issues.ops4j.org/browse/QI-330
>             Project: Qi4j
>          Issue Type: Improvement
>            Reporter: Niclas Hedhman
>
> I have a usecase where a supertype of a composite can not declare being a 
> Value Composite, but all subtypes of it MUST be value composites. It is an 
> assumption in the design.
> It would be cool to be able to put a Type Constraint on a super type, of what 
> the sub types of it must adhere to. For instance,
> {code}
> @MustBeValueComposite
> public interface DomainEvent
> {}
> @TypeConstraints( MustBeValueCompositeContraint.class )
> public @interface MustBeValueComposite
> {}
> public class MustBeValueCompositeConstraint extends TypeConstraint
> {
>     public boolean isValid( Class subType, Module creationIn )
>     {
>         return subType instanceof ValueComposite;
>     }
> }
> {code}

-- 
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