Overview
Package
Class
Use
Tree
Deprecated
Index
All Classes
Help
Prev Class
Next Class
VUtils – Release 1
Class org.violetlib.util.FormattedMessageSupport
Inherited members: ShowHide
Deprecated: ShowHide
org.violetlib.util

Class FormattedMessageSupport

  • Object
    • FormattedMessageSupport
  • public final class FormattedMessageSupport extends Object
    • Static Methods 
      Modifier and Type Static Method and Description
      Ordinary member indicator constructMessage Reveal DetailHide Detail
      static String constructMessage(boolean useHTML, String msg, Object[] args)
      This convenience method is intended primarily for creating HTML error messages that refer to source text.
      public static String constructMessage(boolean useHTML, String msg, Object[] args)
      This convenience method is intended primarily for creating HTML error messages that refer to source text. In the most common case, the error message is constructed using a plain text message and some number of plain text source text segments that should appear “quoted” in the HTML result.

      The basic message msg is assumed to be plain text. It is copied directly (if the selected format is plain text) or encoded into HTML (if the selected format is HTML), except that like printf, certain markers in msg are replaced (typically by the next element of args, formatted in some way as directed by the marker). The arguments may be of any type. If an argument is not a String, it is first converted to a String using the toString method.

      The marker "%q" takes the next element of args to be plain text and formats it to appear as quoted text in the message. If the selected format is HTML, the text is encoded and wrapped in an HTML span with class q. Otherwise, the text is enclosed in quotation marks.

      The marker "%s" copies the next element of args directly to the message. It is assumed to be in the proper format already.

      To include a percent sign in the message, use "%%".

      Parameters:
      useHTML - If true, the returned message is in HTML. Otherwise, the returned message is plain text.
      msg - The basic plain text message.
      args - Each element of this array is converted as needed to a String using the toString method and included in the returned message as described above, replacing the corresponding marker.
      Returns:
      the constructed message.
      • Methods inherited from class Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait