What is Ferris Constraint

This is the Ferris Constraint project. The purpose of this project is to provide a simple set of classes which can be used to check an object against common constraints. For example, an object is required to be not null. This is a simple constraint check handled by the NotNull class. For another example, an integer or date must have a value between some minimum and maximum. This contraint check is handled by the Between class. Additionally, using the decorator pattern, constaints can be chained together to check an object against multiple constraints. For exmaple, suppose a string must not be null, have a length less than 50, and match a standard telephone pattern (xxx)xxx-xxxx This can all be accomplished by chaining constraints together:

Constraint<String> constraint 
  = new NotNull<String>(
      new StringLengthLessThanOrEqualTo(
         50
        ,new StringPattern(Pattern.compile("\\(\\d{3}\\)\\d{3}-\\d{4}"))
      )
  );
  
Check check = constraint.check("hello world");

The Check enum will indicate what, if any, constraint the check did not meet. Developers can use this enum value as part of key to do a locale-specific error message lookup. This message can then be displayed to the user for correction.