Package com.perforce.p4java.messages
Class PerforceMessages
java.lang.Object
com.perforce.p4java.messages.PerforceMessages
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 Summary
FieldsModifier and TypeFieldDescriptionstatic final StringDefault name of the Perforce message bundle properties file. -
Constructor Summary
ConstructorsConstructorDescriptionInstantiates a new perforce messages using the default message bundle properties file package path name .PerforceMessages(String propertiesFile) Instantiates a new perforce messages base on the passed-in message bundle properties file package path name.PerforceMessages(Locale locale) Instantiates a new perforce messages. -
Method Summary
Modifier and TypeMethodDescriptionFormat a message with parameters.Gets the locale.getMessage(String key) Gets the message.getMessage(String key, Object[] params) Gets the message.Gets the messages.voidSets the locale.voidsetMessages(ResourceBundle messages) Sets the messages.
-
Field Details
-
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
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
Instantiates a new perforce messages.- Parameters:
locale- the locale
-
-
Method Details
-
getLocale
Gets the locale.- Returns:
- the locale
-
setLocale
Sets the locale.- Parameters:
locale- the new locale
-
getMessages
Gets the messages.- Returns:
- the messages
-
setMessages
Sets the messages.- Parameters:
messages- the new messages
-
getMessage
Gets the message.- Parameters:
key- the key- Returns:
- the message
-
getMessage
Gets the message.- Parameters:
key- the keyparams- the params- Returns:
- the message
-
format
Format a message with parameters.- Parameters:
message- the messageparams- the params- Returns:
- the string
- See Also:
-