|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.jenkov.mrpersister.impl.mapping.ObjectMapper
public class ObjectMapper
Field Summary | |
---|---|
protected IDbNameDeterminer |
nameDeterminer
|
protected IDbNameGuesser |
nameGuesser
|
protected IObjectMappingFactory |
objectMappingFactory
|
protected IDbPrimaryKeyDeterminer |
primaryKeyDeterminer
|
Constructor Summary | |
---|---|
ObjectMapper(IObjectMappingFactory objectMappingFactory)
|
Method Summary | |
---|---|
protected IObjectMapping |
createObjectMapping(java.lang.Class theClass,
java.lang.String tableName,
java.sql.Connection connection)
|
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 objectClass,
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 objectClass,
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 objectClass,
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. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected IDbNameGuesser nameGuesser
protected IDbNameDeterminer nameDeterminer
protected IDbPrimaryKeyDeterminer primaryKeyDeterminer
protected IObjectMappingFactory objectMappingFactory
Constructor Detail |
---|
public ObjectMapper(IObjectMappingFactory objectMappingFactory)
Method Detail |
---|
public IDbPrimaryKeyDeterminer getDbPrimaryKeyDeterminer()
IObjectMapper
getDbPrimaryKeyDeterminer
in interface IObjectMapper
public void setDbPrimaryKeyDeterminer(IDbPrimaryKeyDeterminer primaryKeyDeterminer)
IObjectMapper
setDbPrimaryKeyDeterminer
in interface IObjectMapper
primaryKeyDeterminer
- The database primary key determiner to be used by this object mapper.public IDbNameGuesser getDbNameGuesser()
IObjectMapper
getDbNameGuesser
in interface IObjectMapper
public void setDbNameGuesser(IDbNameGuesser guesser)
IObjectMapper
setDbNameGuesser
in interface IObjectMapper
guesser
- The databa name guesser to be used by this object mapper.public IDbNameDeterminer getDbNameDeterminer()
IObjectMapper
getDbNameDeterminer
in interface IObjectMapper
public void setDbNameDeterminer(IDbNameDeterminer nameDeterminer)
IObjectMapper
setDbNameDeterminer
in interface IObjectMapper
nameDeterminer
- The database name determiner to be used by this object mapper.public IObjectMapping getObjectMapping(java.lang.Object objectMappingKey, IPersistenceConfiguration configuration, java.sql.Connection connection) throws PersistenceException
IObjectMapper
getObjectMapping
in interface IObjectMapper
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
protected IObjectMapping createObjectMapping(java.lang.Class theClass, java.lang.String tableName, java.sql.Connection connection) throws PersistenceException
PersistenceException
public IObjectMapping mapToTable(java.lang.Class objectClass, IObjectMapping objectMapping, java.sql.Connection connection, java.lang.String databaseName, java.lang.String table) throws PersistenceException
IObjectMapper
mapToTable
in interface IObjectMapper
objectClass
- 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.public IObjectMapping mapGettersToTable(java.lang.Class objectClass, IObjectMapping objectMapping, java.sql.Connection connection, java.lang.String databaseName, java.lang.String table) throws PersistenceException
IObjectMapper
mapGettersToTable
in interface IObjectMapper
objectClass
- 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.public IObjectMapping mapSettersToTable(java.lang.Class objectClass, IObjectMapping objectMapping, java.sql.Connection connection, java.lang.String databaseName, java.lang.String table) throws PersistenceException
IObjectMapper
mapSettersToTable
in interface IObjectMapper
objectClass
- 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.public IObjectMapping mapSettersToSelf(java.lang.Class persistentObjectClass, IObjectMapping objectMapping) throws PersistenceException
IObjectMapper
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).
mapSettersToSelf
in interface IObjectMapper
persistentObjectClass
- The class to map to itself.
PersistenceException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |