Class PerforceMessages

java.lang.Object
com.perforce.p4java.messages.PerforceMessages

public class PerforceMessages extends Object
Handles formatting Perforce messages. It provides locale (language and country) specific messages. The default locale is set during startup of the JVM based on the host environment.

Additionally, this class provides a convenient way to format messages with parameters.

  • Field Details

    • MESSAGE_BUNDLE

      public static final String MESSAGE_BUNDLE
      Default name of the Perforce message bundle properties file.
  • Constructor Details

    • PerforceMessages

      public PerforceMessages()
      Instantiates a new perforce messages using the default message bundle properties file package path name .
    • PerforceMessages

      public PerforceMessages(String propertiesFile)
      Instantiates a new perforce messages base on the passed-in message bundle properties file package path name.
      Parameters:
      propertiesFile - the name (without the extension) of the properties file including the full package path name (i.e. com.perforce.p4java.messages.PerforceMessages)
    • PerforceMessages

      public PerforceMessages(Locale locale)
      Instantiates a new perforce messages.
      Parameters:
      locale - the locale
  • Method Details

    • getLocale

      public Locale getLocale()
      Gets the locale.
      Returns:
      the locale
    • setLocale

      public void setLocale(Locale locale)
      Sets the locale.
      Parameters:
      locale - the new locale
    • getMessages

      public ResourceBundle getMessages()
      Gets the messages.
      Returns:
      the messages
    • setMessages

      public void setMessages(ResourceBundle messages)
      Sets the messages.
      Parameters:
      messages - the new messages
    • getMessage

      public String getMessage(String key)
      Gets the message.
      Parameters:
      key - the key
      Returns:
      the message
    • getMessage

      public String getMessage(String key, Object[] params)
      Gets the message.
      Parameters:
      key - the key
      params - the params
      Returns:
      the message
    • format

      public String format(String message, Object[] params)
      Format a message with parameters.
      Parameters:
      message - the message
      params - the params
      Returns:
      the string
      See Also: