import java.lang.annotation.Documented;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
* All annotations that are used to trigger Constraints must
* have this annotation.
*/
@Retention( RetentionPolicy.RUNTIME )
@Target( ElementType.ANNOTATION_TYPE )
@Documented
public @interface ConstraintDeclaration
{
}
double max();
}
public class RangeConstraint
implements Constraint<Range, Numeric>
{
public boolean isValid( Range annotation, Numeric object )
{
double argument = object.doubleValue();
return argument >= annotation.min() &&
argument <= annotation.max();
}
}