|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface IObjectMapping
Represents one method from an object to the database, and/or from the database to the object. Both way mappings
possible in the same object method.
There can only be one method method containing a given
database column name, and only one method method containing any given object method. While method "overloading"
would seem nice, meaning that you can have many mappings from different query/database fields to the same
object methods all gathered in one object method, this cannot be done for the following reasons:
Method Summary | |
---|---|
void |
addGetterMapping(IGetterMapping mapping)
Adds a getter method method to this object method. |
void |
addSetterMapping(ISetterMapping mapping)
Adds a getter method method to this object method. |
IGetterMapping |
getGetterMapping(java.lang.reflect.Method objectMethod)
Returns the getter method method that is mapped to the object method passed as parameter objectMethod . |
IGetterMapping |
getGetterMapping(java.lang.String columnName)
Returns the getter method method that is mapped to the database column name passed in parameter columnName . |
java.util.Collection |
getGetterMappings()
Returns the method mappings that are mapped to getter methods on the mapped object class. |
java.lang.Class |
getObjectClass()
Returns the class that this object method maps. |
IKey |
getPrimaryKey()
Returns the current primary key mapping. |
java.lang.String |
getPrimaryKeyColumnName()
Deprecated. Use the getPrimaryKey() instead. The IKey interface supports compound keys. |
IGetterMapping |
getPrimaryKeyGetterMapping()
Deprecated. Use the getPrimaryKey() instead. The IKey interface supports compound keys. |
ISetterMapping |
getPrimaryKeySetterMapping()
Deprecated. Use the getPrimaryKey() instead. The IKey interface supports compound keys. |
IKeyValue |
getPrimaryKeyValueForObject(java.lang.Object object,
IKeyValue keyValue)
Returns an IKeyValue instance matching the primary key of this object mapping, and with the key values extracted from the given object. |
IKeyValue |
getPrimaryKeyValueForRecord(java.sql.ResultSet result,
IKeyValue keyValue)
Returns the primary key value as an IKeyValue instance for the record the ResultSet is pointing to. |
ISetterMapping |
getSetterMapping(java.lang.reflect.Method objectMethod)
Returns the setter method method that is mapped to the object method passed as parameter objectMethod . |
ISetterMapping |
getSetterMapping(java.lang.String columnName)
Returns the setter method method that is mapped to the database column name passed in parameter columnName . |
java.util.Collection |
getSetterMappings()
Returns the method mappings that are mapped to setter methods on the mapped object class. |
java.lang.String |
getTableName()
Returns the name of the database table that this object method maps to. |
boolean |
hasAutoGeneratedKeys()
Returns true if this object mapping maps to auto generated keys. |
void |
removeGetterMapping(java.lang.reflect.Method method)
Removes the getter method method that maps from the given Method
to some database column. |
void |
removeGetterMapping(java.lang.String columnName)
Removes the getter method method that maps to the provided database column name (column in table). |
void |
removeSetterMapping(java.lang.reflect.Method method)
Removes the setter method method that maps from the given Method
to some database column. |
void |
removeSetterMapping(java.lang.String columnName)
Removes the setter method method that maps to the given database column name (column in table). |
void |
setObjectClass(java.lang.Class type)
Sets the class that this object method maps. |
void |
setPrimaryKey(IKey key)
Sets the current primary key mapping. |
void |
setPrimaryKeyColumnName(java.lang.String columnName)
Deprecated. Use the setPrimaryKey() instead. The IKey interface supports compound keys. |
void |
setTableName(java.lang.String tableName)
Sets the name of the database table that this object method maps to. |
Method Detail |
---|
java.lang.String getTableName()
void setTableName(java.lang.String tableName)
tableName
- The database table name to map to.java.lang.Class getObjectClass()
void setObjectClass(java.lang.Class type)
type
- The class mapped by this object method.boolean hasAutoGeneratedKeys()
IKeyValue getPrimaryKeyValueForObject(java.lang.Object object, IKeyValue keyValue) throws PersistenceException
object
- The object containing the primary key values to extract into the
IKeyValue instance.
PersistenceException
IKeyValue getPrimaryKeyValueForRecord(java.sql.ResultSet result, IKeyValue keyValue) throws PersistenceException
result
-
PersistenceException
IKey getPrimaryKey()
IKey
instance replaces the previous primary key methods getPrimaryKeyColumn(),
setPrimaryKeyColumn(...), getPrimaryKeyGetterMapping() and getPrimaryKeySetterMapping()
. This new key mapping object supports compound keys, which the previous methods
did not.
void setPrimaryKey(IKey key)
IKey
instance replaces the previous primary key methods getPrimaryKeyColumn(),
setPrimaryKeyColumn(...), getPrimaryKeyGetterMapping() and getPrimaryKeySetterMapping()
. This new key mapping object supports compound keys, which the previous methods
did not.
key
- The key mapping to use as the primary key mapping.java.lang.String getPrimaryKeyColumnName()
void setPrimaryKeyColumnName(java.lang.String columnName)
columnName
- The name of the primary key column in the table that this object method maps to.IGetterMapping getPrimaryKeyGetterMapping()
ISetterMapping getPrimaryKeySetterMapping()
void addGetterMapping(IGetterMapping mapping) throws PersistenceException
mapping
- The method method to add.
PersistenceException
- If the given method method is not valid
(is not null, and does at least contain object method and column name);void addSetterMapping(ISetterMapping mapping) throws PersistenceException
mapping
- The method method to add.
PersistenceException
- If the given method method is not valid
(is not null, and does at least contain object method and column name);void removeGetterMapping(java.lang.String columnName)
columnName
- The database column name of the method method to remove.void removeGetterMapping(java.lang.reflect.Method method)
Method
to some database column.
method
- The method mapped from of the method method to remove.void removeSetterMapping(java.lang.String columnName)
columnName
- The database column name of the setter method method to remove.void removeSetterMapping(java.lang.reflect.Method method)
Method
to some database column.
method
- The method mapped from of the method method to remove.java.util.Collection getGetterMappings()
Collection
of getter method mappings.java.util.Collection getSetterMappings()
Collection
of setter method mappings.IGetterMapping getGetterMapping(java.lang.String columnName)
columnName
. If no getter method method is found with that
database column name, null is returned.
columnName
- The database column name to get the getter method method for.
IGetterMapping getGetterMapping(java.lang.reflect.Method objectMethod)
objectMethod
. If no getter method method is found matching
that Method
, null is returned.
objectMethod
- The method to get the getter method method for.
ISetterMapping getSetterMapping(java.lang.String columnName)
columnName
. If no setter method method is found with that
database column name, null is returned.
columnName
- The database column name to get the setter method method for.
ISetterMapping getSetterMapping(java.lang.reflect.Method objectMethod)
objectMethod
. If no setter method method is found matching
that Method
, null is returned.
objectMethod
- The method to get the setter method method for.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |