Class SimplePreMessage

java.lang.Object
eu.bandm.tools.annotations.SimplePreMessage
All Implemented Interfaces:
PreMessage

public class SimplePreMessage extends Object implements PreMessage
Most simple implementation of a PreMessage.
Since:
1.3
  • Field Details

    • text

      protected final String text
      The template text of the message.
    • args

      protected final Object[] args
      The arguments of the message.
  • Constructor Details

    • SimplePreMessage

      public SimplePreMessage(String text, Object... args)
      Constructs a new instance.
      Parameters:
      text - the template text
      args - the arguments for formatting
      Throws:
      NullPointerException - if text or args are null.
  • Method Details

    • getArgs

      public Object[] getArgs()
      Returns a copy of the arguments.
      Specified by:
      getArgs in interface PreMessage
      Returns:
      a copy of the arguments.
    • getText

      public String getText()
      Returns the template text.
      Specified by:
      getText in interface PreMessage
      Returns:
      the template text.
    • toString

      public String toString()
      Returns a string representation of this object.

      This implementation shows the template text and the arguments unformatted.

      Overrides:
      toString in class Object
      Returns:
      a string representation of this object.
    • preMessage

      public static PreMessage preMessage(String text, Object... args)
      Factory method.
      Parameters:
      text - the template text
      args - the arguments for formatting
      Returns:
      an new instace