|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.jenkov.mrpersister.MappingTool
public class MappingTool
The MappingTool class is a method utility that can show how the
Mr. Persister API will map a given class to a database. This
can be useful to see if your class will be mapped correctly
by the API, or you will have to adjust the mapping manually.
The MappingTool utility can be run from commmand line, or be instantiated
and run from within an application.
The method tool needs a database property file in order to connect to the
database. There has to be the following 4 properties present in the file:
db.driver=xxx
The name of the JDBC driver class used to connect
to the databasedb.url
The URL to the database server used to connect to the database.db.user
The database user name to use to connect to the database.db.password
The password of the database user used to connect to the database
Field Summary | |
---|---|
protected java.lang.Class |
classToMap
|
protected java.io.File |
databasePropertyFile
|
protected java.lang.String |
tableName
|
Constructor Summary | |
---|---|
MappingTool(java.io.File databasePropertyFile,
java.lang.Class theClass)
Initializes the MappingTool instance with the database property file File instance,
and the Class instance of the class to be mapped. |
|
MappingTool(java.io.File databasePropertyFile,
java.lang.Class theClass,
java.lang.String tableName)
Initializes the MappingTool instance with the database property file, the class to be mapped, and the name of the table to map the class to. |
|
MappingTool(java.lang.String[] args)
Initializes the MappingTool instance with arguments passed from the command line. |
Method Summary | |
---|---|
static void |
main(java.lang.String[] args)
Runs the MappingTool application from the command line. |
void |
run()
This method does the hard work. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected java.io.File databasePropertyFile
protected java.lang.Class classToMap
protected java.lang.String tableName
Constructor Detail |
---|
public MappingTool(java.lang.String[] args) throws PersistenceException
args
- The arguments as passed to the application from the command line,
in the main(String[] args)
method.
PersistenceException
- If the arguments are not valid.public MappingTool(java.io.File databasePropertyFile, java.lang.Class theClass)
File
instance,
and the Class
instance of the class to be mapped.
databasePropertyFile
- The database property file.theClass
- The class to be mapped.public MappingTool(java.io.File databasePropertyFile, java.lang.Class theClass, java.lang.String tableName)
databasePropertyFile
- The database property filetheClass
- The class to be mapped to the database table.tableName
- The name of the table to map the class to.Method Detail |
---|
public void run()
run
in interface java.lang.Runnable
public static void main(java.lang.String[] args)
args
- The arguments passed to the MappingTool class from the command line.
The MappingTool class requires two arguments and has an additional optional argument:
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |