|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.jenkov.mrpersister.impl.mapping.ObjectMapping
public class ObjectMapping
Field Summary | |
---|---|
protected java.util.Map |
getterMappingMap
|
protected java.util.Collection |
getterMappingSet
|
protected java.lang.Class |
objectType
|
protected IKey |
primaryKey
|
protected java.lang.String |
primaryKeyColumnName
|
protected java.util.Map |
setterMappingMap
|
protected java.util.Collection |
setterMappingSet
|
protected java.lang.String |
tableName
|
Constructor Summary | |
---|---|
ObjectMapping()
|
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. |
protected void |
appendMethodMappings(java.lang.StringBuffer buffer,
java.util.Collection mappings,
java.lang.String direction,
int length)
|
boolean |
equals(java.lang.Object o)
|
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()
Returns the database column name of the primary key for the table that this object method maps to, if any. |
IGetterMapping |
getPrimaryKeyGetterMapping()
Returns the method method (if any) that maps to the primary key of the table mapped to. |
ISetterMapping |
getPrimaryKeySetterMapping()
Returns the method method (if any) that maps to the primary key of the table mapped to. |
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. |
int |
hashCode()
|
void |
removeGetterFieldMapping(IGetterMapping getterMapping)
|
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 |
removeSetterFieldMapping(ISetterMapping setterMapping)
|
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 objectType)
Sets the class that this object method maps. |
void |
setPrimaryKey(IKey primaryKey)
Sets the current primary key mapping. |
void |
setPrimaryKeyColumnName(java.lang.String primaryKeyColumnName)
Sets the database column name of the primary key for the table that this object method maps to, if any. |
void |
setTableName(java.lang.String tableName)
Sets the name of the database table that this object method maps to. |
java.lang.String |
toString()
|
protected void |
validateMethodMapping(IMethodMapping mapping)
|
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
protected java.lang.String tableName
protected java.lang.String primaryKeyColumnName
protected java.lang.Class objectType
protected java.util.Collection getterMappingSet
protected java.util.Collection setterMappingSet
protected java.util.Map getterMappingMap
protected java.util.Map setterMappingMap
protected IKey primaryKey
Constructor Detail |
---|
public ObjectMapping()
Method Detail |
---|
public java.lang.String getTableName()
IObjectMapping
getTableName
in interface IObjectMapping
public void setTableName(java.lang.String tableName)
IObjectMapping
setTableName
in interface IObjectMapping
tableName
- The database table name to map to.public boolean hasAutoGeneratedKeys()
IObjectMapping
hasAutoGeneratedKeys
in interface IObjectMapping
public IKey getPrimaryKey()
IObjectMapping
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.
getPrimaryKey
in interface IObjectMapping
public void setPrimaryKey(IKey primaryKey)
IObjectMapping
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.
setPrimaryKey
in interface IObjectMapping
primaryKey
- The key mapping to use as the primary key mapping.public java.lang.String getPrimaryKeyColumnName()
IObjectMapping
getPrimaryKeyColumnName
in interface IObjectMapping
public void setPrimaryKeyColumnName(java.lang.String primaryKeyColumnName)
IObjectMapping
setPrimaryKeyColumnName
in interface IObjectMapping
primaryKeyColumnName
- The name of the primary key column in the table that this object method maps to.public java.lang.Class getObjectClass()
IObjectMapping
getObjectClass
in interface IObjectMapping
public void setObjectClass(java.lang.Class objectType)
IObjectMapping
setObjectClass
in interface IObjectMapping
objectType
- The class mapped by this object method.public IKeyValue getPrimaryKeyValueForObject(java.lang.Object object, IKeyValue keyValue) throws PersistenceException
IObjectMapping
getPrimaryKeyValueForObject
in interface IObjectMapping
object
- The object containing the primary key values to extract into the
IKeyValue instance.
PersistenceException
public IKeyValue getPrimaryKeyValueForRecord(java.sql.ResultSet result, IKeyValue keyValue) throws PersistenceException
IObjectMapping
getPrimaryKeyValueForRecord
in interface IObjectMapping
PersistenceException
public void addGetterMapping(IGetterMapping mapping) throws PersistenceException
IObjectMapping
addGetterMapping
in interface IObjectMapping
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);public void addSetterMapping(ISetterMapping mapping) throws PersistenceException
IObjectMapping
addSetterMapping
in interface IObjectMapping
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);protected void validateMethodMapping(IMethodMapping mapping) throws PersistenceException
PersistenceException
public void removeGetterMapping(java.lang.String columnName)
IObjectMapping
removeGetterMapping
in interface IObjectMapping
columnName
- The database column name of the method method to remove.public void removeGetterFieldMapping(IGetterMapping getterMapping)
public void removeGetterMapping(java.lang.reflect.Method method)
IObjectMapping
Method
to some database column.
removeGetterMapping
in interface IObjectMapping
method
- The method mapped from of the method method to remove.public void removeSetterMapping(java.lang.String columnName)
IObjectMapping
removeSetterMapping
in interface IObjectMapping
columnName
- The database column name of the setter method method to remove.public void removeSetterMapping(java.lang.reflect.Method method)
IObjectMapping
Method
to some database column.
removeSetterMapping
in interface IObjectMapping
method
- The method mapped from of the method method to remove.public void removeSetterFieldMapping(ISetterMapping setterMapping)
public java.util.Collection getGetterMappings()
IObjectMapping
getGetterMappings
in interface IObjectMapping
Collection
of getter method mappings.public java.util.Collection getSetterMappings()
IObjectMapping
getSetterMappings
in interface IObjectMapping
Collection
of setter method mappings.public IGetterMapping getPrimaryKeyGetterMapping()
IObjectMapping
getPrimaryKeyGetterMapping
in interface IObjectMapping
public ISetterMapping getPrimaryKeySetterMapping()
IObjectMapping
getPrimaryKeySetterMapping
in interface IObjectMapping
public IGetterMapping getGetterMapping(java.lang.String columnName)
IObjectMapping
columnName
. If no getter method method is found with that
database column name, null is returned.
getGetterMapping
in interface IObjectMapping
columnName
- The database column name to get the getter method method for.
public IGetterMapping getGetterMapping(java.lang.reflect.Method objectMethod)
IObjectMapping
objectMethod
. If no getter method method is found matching
that Method
, null is returned.
getGetterMapping
in interface IObjectMapping
objectMethod
- The method to get the getter method method for.
public ISetterMapping getSetterMapping(java.lang.String columnName)
IObjectMapping
columnName
. If no setter method method is found with that
database column name, null is returned.
getSetterMapping
in interface IObjectMapping
columnName
- The database column name to get the setter method method for.
public ISetterMapping getSetterMapping(java.lang.reflect.Method objectMethod)
IObjectMapping
objectMethod
. If no setter method method is found matching
that Method
, null is returned.
getSetterMapping
in interface IObjectMapping
objectMethod
- The method to get the setter method method for.
public java.lang.String toString()
toString
in class java.lang.Object
protected void appendMethodMappings(java.lang.StringBuffer buffer, java.util.Collection mappings, java.lang.String direction, int length)
public boolean equals(java.lang.Object o)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |