Class Messages
- java.lang.Object
-
- com.sun.tools.corba.ee.idl.som.cff.Messages
-
public abstract class Messages extends java.lang.Object
This class provides messaging services for accessing, and merging parameters into, translatable message text. The text is presumed to reside in a .properties file. A "cff.properties" file that contains all of the message text needed for the CFF framework itself is loaded during class initialization. All of the messages in the cff.properties file that are needed by the CFF framework contain keys that begin with the string "cff.".The static method Messages.msgLoad may be used to merge additional message text .properties files needed by other frameworks or user programs.
- See Also:
msgLoad(java.lang.String)
-
-
Field Summary
Fields Modifier and Type Field Description private static java.lang.String
lineSeparator
private static boolean
loadNeeded
private static java.lang.String
LTB
private static java.util.Properties
m
private static char
NL
-
Constructor Summary
Constructors Constructor Description Messages()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description private static void
fixMessages(java.util.Properties p)
This method was introduced to fix defect #26964.private static void
loadDefaultProperties()
static java.lang.String
msg(java.lang.String msgkey)
Returns the message text corresponding to the passed msgkey string.static java.lang.String
msg(java.lang.String msgkey, int parm)
Returns the message text corresponding to the passed msgkey string.static java.lang.String
msg(java.lang.String msgkey, int parm1, int parm2)
Returns the message text corresponding to the passed msgkey string.static java.lang.String
msg(java.lang.String msgkey, int parm1, java.lang.String parm2)
Returns the message text corresponding to the passed msgkey string.static java.lang.String
msg(java.lang.String msgkey, java.lang.String parm)
Returns the message text corresponding to the passed msgkey string.static java.lang.String
msg(java.lang.String msgkey, java.lang.String parm1, int parm2)
Returns the message text corresponding to the passed msgkey string.static java.lang.String
msg(java.lang.String msgkey, java.lang.String parm1, java.lang.String parm2)
Returns the message text corresponding to the passed msgkey string.static java.lang.String
msg(java.lang.String msgkey, java.lang.String parm1, java.lang.String parm2, java.lang.String parm3)
Returns the message text corresponding to the passed msgkey string.static void
msgLoad(java.lang.String propertyFileName)
Loads additional message keys and text found in the passed properties file.private static java.lang.String
substituteString(java.lang.String orig, int paramNum, java.lang.String subst)
-
-
-
Field Detail
-
LTB
private static final java.lang.String LTB
- See Also:
- Constant Field Values
-
NL
private static final char NL
- See Also:
- Constant Field Values
-
lineSeparator
private static final java.lang.String lineSeparator
-
m
private static final java.util.Properties m
-
loadNeeded
private static boolean loadNeeded
-
-
Method Detail
-
loadDefaultProperties
private static final void loadDefaultProperties()
-
fixMessages
private static final void fixMessages(java.util.Properties p)
This method was introduced to fix defect #26964. For Java 1.0.2 on Win NT, the escape sequence was not being handled correctly by the Java Properties class when it was the final character of a line. Instead the trailing blank was dropped and the next line was swallowed as a continuation. To work around the problem, we introduced our own metasymbol to represent a trailing blank. Hence: Performs substitution for any metasymbols in the message templates. So far only %B is needed. This was introduced to make it more convenient for .properties files to contain message templates with leading or trailing blanks (although %B may actually occur anywhere in a template). Subsequently, checking for '\n' has also been added. Now, wherever '\n' occurs in a message template, it is replaced with the value of System.getProperty ("line.separator").
-
msgLoad
public static final void msgLoad(java.lang.String propertyFileName) throws java.io.IOException
Loads additional message keys and text found in the passed properties file. The specified properties file is assumed to reside in the CLASSPATH. An IOException is thrown if the loading fails.- Parameters:
propertyFileName
- file name of properties file to load- Throws:
java.io.IOException
-
msg
public static final java.lang.String msg(java.lang.String msgkey)
Returns the message text corresponding to the passed msgkey string. If the msgkey cannot be found, its value is returned as the output message text.- Parameters:
msgkey
- key of the message- Returns:
- resulting message text
-
msg
public static final java.lang.String msg(java.lang.String msgkey, java.lang.String parm)
Returns the message text corresponding to the passed msgkey string. The message text is assumed to require the insertion of a single argument, supplied by the "parm" parameter. If the message text does not contain the meta characters "%1" that indicate where to place the argument, the passed argument is appended at the end of the message text.If the msgkey cannot be found, its value is used as the message text.
- Parameters:
msgkey
- message keyparm
- parameter for the message- Returns:
- resulting message text
-
msg
public static final java.lang.String msg(java.lang.String msgkey, int parm)
Returns the message text corresponding to the passed msgkey string. The message text is assumed to require the insertion of a single argument, supplied by the "parm" parameter. If the message text does not contain the meta characters "%1" that indicate where to place the argument, the passed argument is appended at the end of the message text.If the msgkey cannot be found, its value is used as the message text.
-
msg
public static final java.lang.String msg(java.lang.String msgkey, java.lang.String parm1, java.lang.String parm2)
Returns the message text corresponding to the passed msgkey string. The message text is assumed to require the insertion of two arguments, supplied by the "parm1" and "parm2" parameters. If the message text does not contain the meta characters "%1" and "%2" that indicate where to place the arguments, the passed arguments are appended at the end of the message text.If the msgkey cannot be found, its value is used as the message text.
-
msg
public static final java.lang.String msg(java.lang.String msgkey, int parm1, java.lang.String parm2)
Returns the message text corresponding to the passed msgkey string. The message text is assumed to require the insertion of two arguments, supplied by the "parm1" and "parm2" parameters. If the message text does not contain the meta characters "%1" and "%2" that indicate where to place the arguments, the passed arguments are appended at the end of the message text.If the msgkey cannot be found, its value is used as the message text.
-
msg
public static final java.lang.String msg(java.lang.String msgkey, java.lang.String parm1, int parm2)
Returns the message text corresponding to the passed msgkey string. The message text is assumed to require the insertion of two arguments, supplied by the "parm1" and "parm2" parameters. If the message text does not contain the meta characters "%1" and "%2" that indicate where to place the arguments, the passed arguments are appended at the end of the message text.If the msgkey cannot be found, its value is used as the message text.
-
msg
public static final java.lang.String msg(java.lang.String msgkey, int parm1, int parm2)
Returns the message text corresponding to the passed msgkey string. The message text is assumed to require the insertion of two arguments, supplied by the "parm1" and "parm2" parameters. If the message text does not contain the meta characters "%1" and "%2" that indicate where to place the arguments, the passed arguments are appended at the end of the message text.If the msgkey cannot be found, its value is used as the message text.
-
msg
public static final java.lang.String msg(java.lang.String msgkey, java.lang.String parm1, java.lang.String parm2, java.lang.String parm3)
Returns the message text corresponding to the passed msgkey string. The message text is assumed to require the insertion of three arguments, supplied by the "parm1", "parm2" and "parm3" parameters. If the message text does not contain the meta characters "%1" and "%2" that indicate where to place the arguments, the passed arguments are appended at the end of the message text.If the msgkey cannot be found, its value is used as the message text.
-
substituteString
private static java.lang.String substituteString(java.lang.String orig, int paramNum, java.lang.String subst)
-
-