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

Design

We'll now define each interface. Their implementations will be presented at the end of this chapter. Let's start with Message that encapsulates one report message. Every Message will have a type that can be error or warning, a key and a context as shown in the following code:

/**
 * represents one error/warning validation message
 */
public interface Message {
  public enum Type {
    ERROR, WARNING
  }

  /**
   * @return type of this message
   */
  Type getType();

  /**
   * @return key of this message 
   */
  String getMessageKey();

  /**
   * objects in the context must be ordered from the least 
   * specific to most specific
   * @return list of objects in this message's context
   */
  List<Object> getContextOrdered();
}

Code listing 1: Message interface.

The key is used for localized ...

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