|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface IObjectMapper
This interface represents the functions made available by the object mapper in Mr. Persister.
The object mapper is responsible for mapping a class to a database table automatically. The
result of such a method is an object mapping instance. See IObjectMapping for more info on
these.
The object mapper uses a database name guesser, a database name determiner and a
database primary key determiner internally to do it's job.
Method Summary | |
---|---|
IDbNameDeterminer |
getDbNameDeterminer()
Returns the database name determiner used by this object mapper. |
IDbNameGuesser |
getDbNameGuesser()
Returns the database name guesser used by this object mapper. |
IDbPrimaryKeyDeterminer |
getDbPrimaryKeyDeterminer()
Returns the database primary key determiner used by this object mapper. |
IObjectMapping |
getObjectMapping(java.lang.Object objectMappingKey,
IPersistenceConfiguration configuration,
java.sql.Connection connection)
Returns an object mapping from the cache in the given configuration, if one already exists. |
IObjectMapping |
mapGettersToTable(java.lang.Class persistentObjectClass,
IObjectMapping objectMapping,
java.sql.Connection connection,
java.lang.String databaseName,
java.lang.String table)
Maps an object to the table provided as parameter, using method name guessing for the members/fields. |
IObjectMapping |
mapSettersToSelf(java.lang.Class persistentObjectClass,
IObjectMapping objectMapping)
Maps an object to fields named the same as it's setters and adds the method mappings to the provided object mapping. |
IObjectMapping |
mapSettersToTable(java.lang.Class persistentObjectClass,
IObjectMapping objectMapping,
java.sql.Connection connection,
java.lang.String databaseName,
java.lang.String table)
Maps an object to the table provided as parameter, using method name guessing for the members/fields. |
IObjectMapping |
mapToTable(java.lang.Class persistentObjectClass,
IObjectMapping objectMapping,
java.sql.Connection connection,
java.lang.String databaseName,
java.lang.String table)
Maps an object to the table provided as parameter, using method name guessing for the members/fields. |
void |
setDbNameDeterminer(IDbNameDeterminer nameDeterminer)
Sets the database name determiner to be used by this object mapper. |
void |
setDbNameGuesser(IDbNameGuesser guesser)
Sets the database name determiner used by this object mapper. |
void |
setDbPrimaryKeyDeterminer(IDbPrimaryKeyDeterminer primaryKeyDeterminer)
Sets the database primary key determiner to be used by this object mapper. |
Method Detail |
---|
IDbNameGuesser getDbNameGuesser()
void setDbNameGuesser(IDbNameGuesser guesser)
guesser
- The databa name guesser to be used by this object mapper.IDbNameDeterminer getDbNameDeterminer()
void setDbNameDeterminer(IDbNameDeterminer nameDeterminer)
nameDeterminer
- The database name determiner to be used by this object mapper.IDbPrimaryKeyDeterminer getDbPrimaryKeyDeterminer()
void setDbPrimaryKeyDeterminer(IDbPrimaryKeyDeterminer primaryKeyDeterminer)
primaryKeyDeterminer
- The database primary key determiner to be used by this object mapper.IObjectMapping getObjectMapping(java.lang.Object objectMappingKey, IPersistenceConfiguration configuration, java.sql.Connection connection) throws PersistenceException
objectMappingKey
- The key under which to retrieve and/or store the object mapping.configuration
- The configuration containing the object mapping cache.connection
- A database connection used in case the mapper
PersistenceException
IObjectMapping mapToTable(java.lang.Class persistentObjectClass, IObjectMapping objectMapping, java.sql.Connection connection, java.lang.String databaseName, java.lang.String table) throws PersistenceException
persistentObjectClass
- The class of the object to map.objectMapping
- An optional object mapping to add the method mappings to. If null is provided
the object mapper will create an empty object mapping, add the method mappings to it and
return it.connection
- A connection to the database containing the table the objects should be mapped to.databaseName
- The name of the database the table is residing in. In most cases this parameter
can be null, since the connection is normally pointing to a certain database.table
- The name of the database table to map the objects to. Optional. If null is given the
object mapper will try to guess the table name from the objects class name.
PersistenceException
- If anything goes wrong during the method.IObjectMapping mapGettersToTable(java.lang.Class persistentObjectClass, IObjectMapping objectMapping, java.sql.Connection connection, java.lang.String databaseName, java.lang.String table) throws PersistenceException
persistentObjectClass
- The class of the object to map.objectMapping
- An optional object mapping to add the method mappings to. If null is provided
the object mapper will create an empty object mapping, add the method mappings to it and
return it.connection
- A connection to the database containing the table the objects should be mapped to.databaseName
- The name of the database the table is residing in. In most cases this parameter
can be null, since the connection is normally pointing to a certain database.table
- The name of the database table to map the objects to. Optional. If null is given the
object mapper will try to guess the table name from the objects class name.
PersistenceException
- If anything goes wrong during the method.IObjectMapping mapSettersToTable(java.lang.Class persistentObjectClass, IObjectMapping objectMapping, java.sql.Connection connection, java.lang.String databaseName, java.lang.String table) throws PersistenceException
persistentObjectClass
- The class of the object to map.objectMapping
- An optional object mapping to add the method mappings to. If null is provided
the object mapper will create an empty object mapping, add the method mappings to it and
return it.connection
- A connection to the database containing the table the objects should be mapped to.databaseName
- The name of the database the table is residing in. In most cases this parameter
can be null, since the connection is normally pointing to a certain database.table
- The name of the database table to map the objects to. Optional. If null is given the
object mapper will try to guess the table name from the objects class name.
PersistenceException
- If anything goes wrong during the method.IObjectMapping mapSettersToSelf(java.lang.Class persistentObjectClass, IObjectMapping objectMapping) throws PersistenceException
select homeAddr as setHomeAddress from users
. The method in the
result set will be called setHomeAddres. The object mapping will then translate that name to the
setHomeAddress(...) method (because that method is mapped to a method called "setHomeAddress" in the
object mapping).
persistentObjectClass
- The class to map to itself.
PersistenceException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |