|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface IObjectMappingFactory
This interface represents the functions of the object mapping factorie(s) used by Mr. Persister.
The purpose of the object mapping factory is to make it easier for the users of the API to
create customized object mappings and method mappings.
The object mapping factory is also used by the object mapper in Mr. Persister.
Method Summary | |
---|---|
void |
addGetterMapping(IObjectMapping mapping,
java.lang.String methodName,
java.lang.String columnName,
boolean isTableMapped)
Adds a getter method to the given object mapping. |
void |
addGetterMapping(IObjectMapping mapping,
java.lang.String methodName,
java.lang.String columnName,
boolean isTableMapped,
boolean isPrimaryKey,
boolean isAutoGenerated)
Adds a getter method to the given object mapping. |
void |
addSetterMapping(IObjectMapping mapping,
java.lang.String methodName,
java.lang.Class parameterType,
java.lang.String columnName,
boolean isTableMapped)
Adds a setter method to the given object mapping. |
void |
addSetterMapping(IObjectMapping mapping,
java.lang.String methodName,
java.lang.Class parameterType,
java.lang.String columnName,
boolean isTableMapped,
boolean isPrimaryKey)
Adds a setter method to the given object mapping. |
void |
addSetterMapping(IObjectMapping mapping,
java.lang.String methodName,
java.lang.String columnName,
boolean isTableMapped)
Adds a setter method to the given object mapping. |
void |
addSetterMapping(IObjectMapping mapping,
java.lang.String methodName,
java.lang.String columnName,
boolean isTableMapped,
boolean isPrimaryKey)
Adds a setter method to the given object mapping. |
IGetterMapping |
copyGetterMapping(IGetterMapping source)
Copies a getter method mapping. |
IObjectMapping |
copyObjectMapping(IObjectMapping source)
Returns a new object mapping that is an exact copy of the original. |
ISetterMapping |
copySetterMapping(ISetterMapping source)
Copies the original setter method mapping. |
IGetterMapping |
createGetterMapping(java.lang.Class objectType)
Creates an empty getter method mapping of the type that matches the objectType parameter. |
IGetterMapping |
createGetterMapping(java.lang.Class methodOwner,
java.lang.String methodName,
java.lang.String columnName)
|
IGetterMapping |
createGetterMapping(java.lang.Class methodOwner,
java.lang.String methodName,
java.lang.String columnName,
boolean isTableMapped)
|
IGetterMapping |
createGetterMapping(java.lang.reflect.Method method,
java.lang.String dbFieldName,
boolean isTableMapped)
Creates a getter method mapping with the given Method , database column name, and
isTableMapped values prefilled. |
IObjectMappingKey |
createInstance(java.lang.Class objectClass)
Deprecated. Renamed to createObjectMappingKey |
IObjectMappingKey |
createInstance(java.lang.Class objectClass,
ICustomObjectMapper mapper)
Deprecated. Renamed to createObjectMappingKey |
IObjectMappingKey |
createInstance(java.lang.Class objectClass,
java.lang.String name)
Deprecated. Renamed to createObjectMappingKey |
IObjectMappingKey |
createInstance(java.lang.Class objectClass,
java.lang.String name,
ICustomObjectMapper mapper)
Deprecated. Renamed to createObjectMappingKey |
IKey |
createKey()
Creates a new IKey instance. |
IObjectMapping |
createObjectMapping()
Creates an empty object mapping instance. |
IObjectMapping |
createObjectMapping(java.lang.Class objectClass,
java.lang.String tableName)
Creates an object mapping with the object class and table. |
IObjectMapping |
createObjectMapping(java.lang.Class objectClass,
java.lang.String tableName,
java.lang.String primaryKeyColumn)
Creates an object mapping with the object class, table name, and primary key column preset. |
ISetterMapping |
createSetterMapping(java.lang.Class objectType)
Creates an empty setter method mapping of a type matching the objectType class. |
ISetterMapping |
createSetterMapping(java.lang.Class methodOwner,
java.lang.String methodName,
java.lang.Class parameterType,
java.lang.String columnName)
|
ISetterMapping |
createSetterMapping(java.lang.Class methodOwner,
java.lang.String methodName,
java.lang.Class parameterType,
java.lang.String columnName,
boolean isTableMapped)
|
ISetterMapping |
createSetterMapping(java.lang.Class methodOwner,
java.lang.String methodName,
java.lang.String columnName)
|
ISetterMapping |
createSetterMapping(java.lang.Class methodOwner,
java.lang.String methodName,
java.lang.String columnName,
boolean isTableMapped)
|
ISetterMapping |
createSetterMapping(java.lang.reflect.Method method,
java.lang.String dbFieldName,
boolean isTableMapped)
Creates a setter method mapping prefilled with the Method , database column name, and
isTableMapped values prefilled. |
Method Detail |
---|
IObjectMappingKey createInstance(java.lang.Class objectClass)
objectClass
- The class this object mapping key represents an object mapping for.
IObjectMappingKey createInstance(java.lang.Class objectClass, java.lang.String name)
objectClass
- The class this object mapping key represents an object mapping for.name
- The name to set on the object mapping key. Name is only for debug use.
IObjectMappingKey createInstance(java.lang.Class objectClass, ICustomObjectMapper mapper)
objectClass
- The class this object mapping key represents an object mapping for.mapper
- A custom object mapper that can assist the auto-mapper when mapping the class to the database.
IObjectMappingKey createInstance(java.lang.Class objectClass, java.lang.String name, ICustomObjectMapper mapper)
objectClass
- The class this object mapping key represents an object mapping for.name
- The name to set on the object mapping key. Name is only for debug use.mapper
- A custom object mapper that can assist the auto-mapper when mapping the class to the database.
IObjectMapping createObjectMapping()
IObjectMapping createObjectMapping(java.lang.Class objectClass, java.lang.String tableName)
objectClass
- The object class to maptableName
- The database table to map to
IObjectMapping createObjectMapping(java.lang.Class objectClass, java.lang.String tableName, java.lang.String primaryKeyColumn)
objectClass
- The object class to maptableName
- The database table to map toprimaryKeyColumn
- The name of the primary key column in that table
IObjectMapping copyObjectMapping(IObjectMapping source)
source
- The object mapping to copy.
IGetterMapping createGetterMapping(java.lang.Class objectType)
PreparedStatement
instances.
For instance, if this getter method mapping is supposed to extract
values from the getter method String getName()
the class
passed in the objectType parameter should be String.class .
objectType
- The class of the object returned by the getter (it's return type) to be mapped by this
getter method mapping.
IGetterMapping
instance.IGetterMapping createGetterMapping(java.lang.Class methodOwner, java.lang.String methodName, java.lang.String columnName) throws PersistenceException
PersistenceException
IGetterMapping createGetterMapping(java.lang.Class methodOwner, java.lang.String methodName, java.lang.String columnName, boolean isTableMapped) throws PersistenceException
PersistenceException
IGetterMapping createGetterMapping(java.lang.reflect.Method method, java.lang.String dbFieldName, boolean isTableMapped)
Method
, database column name, and
isTableMapped values prefilled. The getter method mapping will be of a type matching the
return type of the getter method.
method
- The getter Method
to map from.dbFieldName
- The database column name to map to.isTableMapped
- Set to true if the database column exists in a table.
False if not (if it only exists in a SQL query).
IGetterMapping
with the given parameters prefilled.IGetterMapping copyGetterMapping(IGetterMapping source)
source
- The IGetterMapping
instance to copy.
IGetterMapping
that is equal to the original.ISetterMapping createSetterMapping(java.lang.Class objectType)
setName(String name)
then the class passed in the objectType parameter should be
String.class .
objectType
- The type/class that this setter method mapping will be able to set on target objects.
ISetterMapping
instance matching the given objectType.ISetterMapping createSetterMapping(java.lang.Class methodOwner, java.lang.String methodName, java.lang.String columnName) throws PersistenceException
PersistenceException
ISetterMapping createSetterMapping(java.lang.Class methodOwner, java.lang.String methodName, java.lang.Class parameterType, java.lang.String columnName) throws PersistenceException
PersistenceException
ISetterMapping createSetterMapping(java.lang.Class methodOwner, java.lang.String methodName, java.lang.Class parameterType, java.lang.String columnName, boolean isTableMapped) throws PersistenceException
PersistenceException
ISetterMapping createSetterMapping(java.lang.Class methodOwner, java.lang.String methodName, java.lang.String columnName, boolean isTableMapped) throws PersistenceException
PersistenceException
ISetterMapping createSetterMapping(java.lang.reflect.Method method, java.lang.String dbFieldName, boolean isTableMapped)
Method
, database column name, and
isTableMapped values prefilled. The setter method mapping will be of a type matching the class
of setter methods parameter.
method
- The setter method
to map from.dbFieldName
- The database column to map to.isTableMapped
- Set to true if the database column exists in a table.
False if not (if for instance the database column only exists in an SQL query).
ISetterMapping
with the passed parameter values prefilled,
matching the parameter type of the setter method.ISetterMapping copySetterMapping(ISetterMapping source)
ISetterMapping
instance. Changing the copy will not affect the original.
source
- The ISetterMapping
instance to copy.
ISetterMapping
that is equal to the original.void addGetterMapping(IObjectMapping mapping, java.lang.String methodName, java.lang.String columnName, boolean isTableMapped) throws java.lang.NoSuchMethodException, PersistenceException
isTableMapped
tells whether
the column exists in a table in the database, or only in an SQL query. This
information is used when generating SQL for reads and writes.
mapping
- The object mapping to add the getter method to.methodName
- The name of the method to map from.columnName
- The name of the column to map to.isTableMapped
- Set to true if the column exists in a database table.
False if the column only exists in an SQL query.
java.lang.NoSuchMethodException
- If no method is found with the given method name.
PersistenceException
- If the object mapping does not contain an object class
(getObjectClass()== null
).void addGetterMapping(IObjectMapping mapping, java.lang.String methodName, java.lang.String columnName, boolean isTableMapped, boolean isPrimaryKey, boolean isAutoGenerated) throws java.lang.NoSuchMethodException, PersistenceException
isTableMapped
tells whether
the column exists in a table in the database, or only in an SQL query. This
information is used when generating SQL for reads and writes.
mapping
- The object mapping to add the getter method to.methodName
- The name of the method to map from.columnName
- The name of the column to map to.isTableMapped
- Set to true if the column exists in a database table.
False if the column only exists in an SQL query.isPrimaryKey
- Set to true if the column is the primary key of the table. False if not.isAutoGenerated
- Set to true if the column is auto generated by the database. False if not.
java.lang.NoSuchMethodException
- If no method is found with the given method name.
PersistenceException
- If the object mapping does not contain an object class
(getObjectClass()== null
).void addSetterMapping(IObjectMapping mapping, java.lang.String methodName, java.lang.String columnName, boolean isTableMapped) throws java.lang.NoSuchMethodException, PersistenceException
isTableMapped
tells whether
the column exists in a table in the database, or only in an SQL query. This
information is used when generating SQL for reads and writes.
mapping
- The object mapping to add the setter method to.methodName
- The name of the method to map from.columnName
- The name of the column to map to.isTableMapped
- Set to true if the column exists in a database table.
False if the column only exists in an SQL query.
java.lang.NoSuchMethodException
- If no method is found with the given method name.
PersistenceException
- If the object mapping does not contain an object class
(getObjectClass()== null
).void addSetterMapping(IObjectMapping mapping, java.lang.String methodName, java.lang.String columnName, boolean isTableMapped, boolean isPrimaryKey) throws java.lang.NoSuchMethodException, PersistenceException
isTableMapped
tells whether
the column exists in a table in the database, or only in an SQL query. This
information is used when generating SQL for reads and writes.
mapping
- The object mapping to add the setter method to.methodName
- The name of the method to map from.columnName
- The name of the column to map to.isTableMapped
- Set to true if the column exists in a database table.
False if the column only exists in an SQL query.isPrimaryKey
- Set to true if the column is the primary key of the table. False if not.
java.lang.NoSuchMethodException
- If no method is found with the given method name.
PersistenceException
- If the object mapping does not contain an object class
(getObjectClass()== null
).void addSetterMapping(IObjectMapping mapping, java.lang.String methodName, java.lang.Class parameterType, java.lang.String columnName, boolean isTableMapped) throws java.lang.NoSuchMethodException, PersistenceException
parameterType
parameter tells which setter method to use,
if you have more than one setter method with the same name, but different
parameter types (overloaded setter methods).
isTableMapped
tells whether
the column exists in a table in the database, or only in an SQL query. This
information is used when generating SQL for reads and writes.
mapping
- The object mapping to add the setter method to.methodName
- The name of the method to map from.parameterType
- The parameter type of the setter method to map,
in case of overloaded setter methods.columnName
- The name of the column to map to.isTableMapped
- Set to true if the column exists in a database table.
False if the column only exists in an SQL query.
java.lang.NoSuchMethodException
- If no method is found with the given method name and parameter type.
PersistenceException
- If the object mapping does not contain an object class
(getObjectClass()== null
).void addSetterMapping(IObjectMapping mapping, java.lang.String methodName, java.lang.Class parameterType, java.lang.String columnName, boolean isTableMapped, boolean isPrimaryKey) throws java.lang.NoSuchMethodException, PersistenceException
parameterType
parameter tells which setter method to use,
if you have more than one setter method with the same name, but different
parameter types (overloaded setter methods).
isTableMapped
tells whether
the column exists in a table in the database, or only in an SQL query. This
information is used when generating SQL for reads and writes.
mapping
- The object mapping to add the setter method to.methodName
- The name of the method to map from.parameterType
- The parameter type of the setter method to map,
in case of overloaded setter methods.columnName
- The name of the column to map to.isTableMapped
- Set to true if the column exists in a database table.
False if the column only exists in an SQL query.isPrimaryKey
- Set to true if the column is the priary key of the table. False if not.
java.lang.NoSuchMethodException
- If no method is found with the given method name and parameter type.
PersistenceException
- If the object mapping does not contain an object class
(getObjectClass()== null
).IKey createKey()
IKey
instance. Key instances are used
to represent database keys. For instance primary keys and foreign keys.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |