Conditions

The rules wouldn't be very useful if all you could do was always protect or require properties. This behavior is usually based on conditions. Rules take as input one or more Conditions (e.g. objects implementing the Condition interface). Right now, there are several conditions that can be used:

Each of these conditions is accessible from the corresponding property or condition. There should be no reason in normal development to use the constructors for the conditions above. Instead, you could say, for instance


Condition isPrimaryName = PersonName.properties.isPrimaryName.isTrue();

or


Condition isAlias 
   = PersonName.properties.nameType.isEqualTo(NameTypeLookup.ALIAS);

or


   Condition greaterThan 
      = PersonName.properties.sequence.isGreaterThan(BigInteger.ZERO);

or


Condition hasOnePrimaryName 
   = Person.properties.names.containsAtLeastOne(isPrimaryName);

or


Condition notAlias = isAlias.not();