Class MsgUtil


  • public final class MsgUtil
    extends java.lang.Object
    A utility class to construct log-style message Strings. This uses java.text.MessageFormat, so it is not particularly fast, but that's ok since its mostly used for Exception construction anyway.
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static java.lang.String generateMessage​(java.lang.String original, int idx)
      Generic method to extract the required part of text from the original string
      static java.lang.String getMsg​(java.lang.String code)
      Format a Msg0 into a String.
      static java.lang.String getMsg​(java.lang.String code, java.lang.Object arg0)
      Format a Msg1 into a String.
      static java.lang.String getMsg​(java.lang.String code, java.lang.Object arg0, java.lang.Object arg1)
      Format a Msg2 into a String.
      static java.lang.String getMsg​(java.lang.String code, java.lang.Object arg0, java.lang.Object arg1, java.lang.Object arg2)
      Format a Msg3 into a String.
      static java.lang.String getMsg​(java.lang.String code, java.lang.Object arg0, java.lang.Object arg1, java.lang.Object arg2, java.lang.Object arg3)
      Format a Msg4 into a String.
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • getMsg

        public static java.lang.String getMsg​(java.lang.String code)
        Format a Msg0 into a String.
        Parameters:
        msg - the Msg object to be formatted
        Returns:
        the assembled String
      • getMsg

        public static java.lang.String getMsg​(java.lang.String code,
                                              java.lang.Object arg0)
        Format a Msg1 into a String.
        Parameters:
        msg - the Msg object to be formatted
        arg0 - the first message argument
        Returns:
        the assembled String
      • getMsg

        public static java.lang.String getMsg​(java.lang.String code,
                                              java.lang.Object arg0,
                                              java.lang.Object arg1)
        Format a Msg2 into a String.
        Parameters:
        msg - the Msg object to be formatted
        arg0 - the first message argument
        arg1 - the second message argument
        Returns:
        the assembled String
      • getMsg

        public static java.lang.String getMsg​(java.lang.String code,
                                              java.lang.Object arg0,
                                              java.lang.Object arg1,
                                              java.lang.Object arg2)
        Format a Msg3 into a String.
        Parameters:
        msg - the Msg object to be formatted
        arg0 - the first message argument
        arg1 - the second message argument
        arg2 - the third message argument
        Returns:
        the assembled String
      • getMsg

        public static java.lang.String getMsg​(java.lang.String code,
                                              java.lang.Object arg0,
                                              java.lang.Object arg1,
                                              java.lang.Object arg2,
                                              java.lang.Object arg3)
        Format a Msg4 into a String.
        Parameters:
        msg - the Msg object to be formatted
        arg0 - the first message argument
        arg1 - the second message argument
        arg2 - the third message argument
        arg3 - the fourth message argument
        Returns:
        the assembled String
      • generateMessage

        public static java.lang.String generateMessage​(java.lang.String original,
                                                       int idx)
        Generic method to extract the required part of text from the original string
        Parameters:
        original - the original msg to be looked upon
        idx - index at which we want to fetch info
        Returns:
        the desired text