|
miSim | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--misim.util.TxtParser
TxtParser generates the Txt.java internationalisation class from a message file. The message file defines all messages that will be used by the software, and their identifiers. Each message is on a separate line, and is of the form:
MESSAGE_IDENTIFIER = A message with %1 replacements
where MESSAGE_IDENTIFIER will become a static integer message identifier, and the message is stored as a string, where text may be inserted in place of the %n identifiers (where n is a number from 1 to 9). The auto generated Txt.java class extends TxtBaseClass.java which provides the core message retrieval functions.
Constructor Summary | |
TxtParser()
Constructor, which simply initialises the global message and identifier Vectors. |
Method Summary | |
static void |
main(java.lang.String[] args)
Main method invoked to read the message file and generate a java class file that provides message retrieval and internationalisation. |
void |
parseGroup(SettingsGroup group)
Read all of the settings in the given group into the global Vectors of messages and identifiers. |
void |
readText(java.lang.String fromFile,
java.lang.String toFile)
Read a settings file, and call parseGroup to parse all settings groups in that file into messages and identifiers, then generate the Txt.java file that stores and retrieves these messages. |
void |
writeFile(java.lang.String toFile)
Generate the Java source file for Txt.java, containing the get() method, and all of the message identifiers and values. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public TxtParser()
Method Detail |
public void readText(java.lang.String fromFile, java.lang.String toFile) throws java.lang.Exception
fromFile
- The name of the message file to readtoFile
- The name of the java source file to writejava.lang.Exception
- If any errors occured whilst reading or writing the files.public void writeFile(java.lang.String toFile) throws java.lang.Exception
toFile
- The name of the file to writepublic void parseGroup(SettingsGroup group)
group
- The SettingsGroup to readpublic static void main(java.lang.String[] args)
|
miSim | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |