Using Entity-Specific Validation Rules
You can implement more complex validation rules for your business domain layer by using your own Java code in Method validators. You code the rule in Java, and it is triggered by the Method validator at the appropriate point in the entity object validation cycle.
You can create entity-level or attribute-level Method validators. You can add any number of attribute-level or entity-level Method validators, provided they each trigger a distinct method name in your code. There are many types of validation you can code with a Method validator, either on an attribute or on an entity.
The method must be defined as public and return a Boolean value. The name of the method must begin with the keyword validate. The code can be as complex or simple as the validation rules require.