O'Reilly logo

Drools JBoss Rules 5.0 Developer's Guide by Michal Bali, Bogdan Brinzarea

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Validation service

All of the rules are implemented as unit tests, and we can write a validation service that our clients can access. It will define one method for validating a customer. The following code shows the BankingValidationService interface:

/**
 * service for validating the banking domain
 */
public interface BankingValidationService {
  /**
   * validates given customer and returns validation report
   */
  ValidationReport validate(Customer customer);
}

Code listing 21: BankingValidationService interface.

The interface defines one method that validates a Customer object and returns ValidationReport. As all of the objects in our domain model are accessible (traversable) from the Customer object, it is sufficient to just pass this class as the method ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required