O'Reilly logo

Drools JBoss Rules 5.X Developer's Guide by Michal Bali

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, starting with Message that encapsulates one report message. Their implementations will be presented at the end of this chapter. Every message will have a type that can be an error or a warning, a key, and a context.

/**
 * 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 message lookups. The ...

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