|
RbUtils 0.13 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.ktc.rbutils.api.i18n.AbstractLocalized
org.ktc.rbutils.api.audit.AbstractProcessor
org.ktc.rbutils.api.audit.AbstractFileProcessor
org.ktc.rbutils.rb.generation.FileGenerator
public class FileGenerator
Generates a Java RessourceBundle source class using a Properties file.
Package name resolution is proceeded using the relative path of the Properties file from a root directory.
MainGenerator
Field Summary | |
---|---|
protected static String |
TAB
String used for tabulation representation on code generation. |
Fields inherited from class org.ktc.rbutils.api.audit.AbstractFileProcessor |
---|
className, fileLocale, fileName |
Fields inherited from class org.ktc.rbutils.api.audit.AbstractProcessor |
---|
loggers |
Fields inherited from class org.ktc.rbutils.api.i18n.AbstractLocalized |
---|
classResource |
Constructor Summary | |
---|---|
FileGenerator(File propsRootDir,
File propsFile,
File genRootdir)
Instanciates a new FileGenerator . |
Method Summary | |
---|---|
protected static String |
escape(String theString)
Escapes characters in order to get a String with only Unicode characters. |
protected static String |
escapeKey(String key)
Escapes the dot character in the String argument into the underscore character. |
protected static String |
getJavaRbClassName(File propsFile)
Gets the name of the class generated from a Properties file. |
protected static File |
getJavaRbFile(File propsRootDir,
File propsFile,
File genRootdir)
Gets the File of the Java ResourceBundle according to the relative path of a
properties file from its root directory. |
protected void |
performGeneration()
Performs the generation of the Java File. |
protected static String |
tab(int tabNumber)
Returns a String which contains the number of tabulations specified as argument. |
Methods inherited from class org.ktc.rbutils.api.audit.AbstractFileProcessor |
---|
fireError, fireInformation, fireProcessFileEnded, fireProcessFileStarted |
Methods inherited from class org.ktc.rbutils.api.audit.AbstractProcessor |
---|
addLogger, addLoggers, fireException |
Methods inherited from class org.ktc.rbutils.api.i18n.AbstractLocalized |
---|
getMessage |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface org.ktc.rbutils.api.audit.Processor |
---|
addLogger, addLoggers, fireException |
Field Detail |
---|
protected static final String TAB
Constructor Detail |
---|
public FileGenerator(File propsRootDir, File propsFile, File genRootdir) throws IOException
FileGenerator
.
propsRootDir
and genRootdir
must be directories that exist in
the filesystem.
propsFile
must be a file that exists in the filesystem.
propsRootDir
- the root directory of the properties file used to resolve package name.propsFile
- the properties file used to generate the java file.genRootdir
- the target root directory where the java file will be put after package
name resolution and file generation.
NullArgumentException
- if a parameter is null
.
FileNotFoundException
- if a parameter is a File
that does not
exist in the filesystem.
NotDirectoryException
- if propsRootDir
or
genRootdir
is not a directory in the filesystem.
NotFileException
- if propsFile
is not a file
in the filesystem.
IOException
- if problems occured on Properties file load.Method Detail |
---|
protected void performGeneration()
The contents of the properties file is used to create the data of the java file. Then, the java file is created in the filesystem.
protected static String getJavaRbClassName(File propsFile)
This is the name of the file without extension.
propsFile
- Properties file used for name resolution.
protected static File getJavaRbFile(File propsRootDir, File propsFile, File genRootdir) throws FileNotFoundException
File
of the Java ResourceBundle according to the relative path of a
properties file from its root directory.
The returned File
will be in a parent directory of genRootdir
.
It will have the same relative path to genRootdir
that propsFile
to propsRootDir
.
propsRootDir
- the root directory of the properties file used to resolve relative path.propsFile
- the properties file used to resolve relative path.genRootdir
- the target root directory where the java file will be put.
File
.
FileNotFoundException
- if one of the argument represent a file that does not exist in
the filesystem.protected static String escape(String theString)
String
with only Unicode characters.
theString
- the String to be escaped.
protected static String escapeKey(String key)
This can be used on field generation in order to avoid compilation error (as the dot character is reserved for accessors).
key
- the key to be escaped.
null
if key
is null
.protected static String tab(int tabNumber)
tabNumber
- number of tabulations
|
Back to the RbUtils Home Page | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |