interface Constraint

The Constraint interface is used to implement Constraint checking implementations.

Description

Constraint implementations are declared on Composites that require Constraint checking of method arguments and/or Property set() methods.

The Constraint will co-operate with a custom annotation, which is used to mark which method argument to be linked to the Constraint. The annotation can also contain arguments, for instance to provide range checks.

The Constraint will be provided the annotation and the value that is passed in the method.

The Constraint simply returns true if the argument is Ok, and otherwise false. It should avoid throwing exceptions.

Declaration

package org.qi4j.composite;

import java.lang.annotation.Annotation;

public interface Constraint<A extends Annotation, P>
{
    boolean isValid( A annotation, P value )
        throws NullPointerException;
}

Example

Description of Example goes here...
  if( ... )
Powered by SiteVisionexternal link.