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