|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.jenkov.mrpersister.impl.mapping.ObjectMappingFactory
public class ObjectMappingFactory
Constructor Summary | |
---|---|
ObjectMappingFactory()
|
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. |
protected void |
assureObjectClass(IObjectMapping 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 memberType)
Creates an empty getter method mapping of the type that matches the objectType parameter. |
IGetterMapping |
createGetterMapping(java.lang.Class theClass,
java.lang.String methodName,
java.lang.String columnName)
|
IGetterMapping |
createGetterMapping(java.lang.Class theClass,
java.lang.String methodName,
java.lang.String columnName,
boolean isTableMapped)
|
IGetterMapping |
createGetterMapping(java.lang.reflect.Method member,
java.lang.String columnName,
boolean isTableMapped)
Creates a getter method mapping with the given Method , database column name, and
isTableMapped values prefilled. |
IObjectMappingKey |
createInstance(java.lang.Class objectClass)
Creates an object mapping key with the class set. |
IObjectMappingKey |
createInstance(java.lang.Class objectClass,
ICustomObjectMapper mapper)
Creates an object mapping key with the class set. |
IObjectMappingKey |
createInstance(java.lang.Class objectClass,
java.lang.String name)
Creates an object mapping key with the class set. |
IObjectMappingKey |
createInstance(java.lang.Class objectClass,
java.lang.String name,
ICustomObjectMapper mapper)
Creates an object mapping key with the class set. |
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 memberType)
Creates an empty setter method mapping of a type matching the objectType class. |
ISetterMapping |
createSetterMapping(java.lang.Class theClass,
java.lang.String methodName,
java.lang.Class parameterType,
java.lang.String columnName)
|
ISetterMapping |
createSetterMapping(java.lang.Class theClass,
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 member,
java.lang.String columnName,
boolean isTableMapped)
Creates a setter method mapping prefilled with the Method , database column name, and
isTableMapped values prefilled. |
protected java.lang.Class |
getMemberType(java.lang.reflect.Method method)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ObjectMappingFactory()
Method Detail |
---|
public IObjectMappingKey createInstance(java.lang.Class objectClass)
IObjectMappingFactory
createInstance
in interface IObjectMappingFactory
objectClass
- The class this object mapping key represents an object mapping for.
public IObjectMappingKey createInstance(java.lang.Class objectClass, java.lang.String name)
IObjectMappingFactory
createInstance
in interface IObjectMappingFactory
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.
public IObjectMappingKey createInstance(java.lang.Class objectClass, ICustomObjectMapper mapper)
IObjectMappingFactory
createInstance
in interface IObjectMappingFactory
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.
public IObjectMappingKey createInstance(java.lang.Class objectClass, java.lang.String name, ICustomObjectMapper mapper)
IObjectMappingFactory
createInstance
in interface IObjectMappingFactory
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.
public IObjectMapping createObjectMapping()
IObjectMappingFactory
createObjectMapping
in interface IObjectMappingFactory
public IObjectMapping createObjectMapping(java.lang.Class objectClass, java.lang.String tableName)
IObjectMappingFactory
createObjectMapping
in interface IObjectMappingFactory
objectClass
- The object class to maptableName
- The database table to map to
public IObjectMapping createObjectMapping(java.lang.Class objectClass, java.lang.String tableName, java.lang.String primaryKeyColumn)
IObjectMappingFactory
createObjectMapping
in interface IObjectMappingFactory
objectClass
- The object class to maptableName
- The database table to map toprimaryKeyColumn
- The name of the primary key column in that table
public IObjectMapping copyObjectMapping(IObjectMapping source)
IObjectMappingFactory
copyObjectMapping
in interface IObjectMappingFactory
source
- The object mapping to copy.
public IGetterMapping createGetterMapping(java.lang.Class memberType)
IObjectMappingFactory
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 .
createGetterMapping
in interface IObjectMappingFactory
memberType
- The class of the object returned by the getter (it's return type) to be mapped by this
getter method mapping.
IGetterMapping
instance.public IGetterMapping createGetterMapping(java.lang.Class theClass, java.lang.String methodName, java.lang.String columnName) throws PersistenceException
createGetterMapping
in interface IObjectMappingFactory
PersistenceException
public IGetterMapping createGetterMapping(java.lang.Class theClass, java.lang.String methodName, java.lang.String columnName, boolean isTableMapped) throws PersistenceException
createGetterMapping
in interface IObjectMappingFactory
PersistenceException
public IGetterMapping createGetterMapping(java.lang.reflect.Method member, java.lang.String columnName, boolean isTableMapped)
IObjectMappingFactory
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.
createGetterMapping
in interface IObjectMappingFactory
member
- The getter Method
to map from.columnName
- 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.public IGetterMapping copyGetterMapping(IGetterMapping source)
IObjectMappingFactory
copyGetterMapping
in interface IObjectMappingFactory
source
- The IGetterMapping
instance to copy.
IGetterMapping
that is equal to the original.public ISetterMapping createSetterMapping(java.lang.Class memberType)
IObjectMappingFactory
setName(String name)
then the class passed in the objectType parameter should be
String.class .
createSetterMapping
in interface IObjectMappingFactory
memberType
- The type/class that this setter method mapping will be able to set on target objects.
ISetterMapping
instance matching the given objectType.public ISetterMapping createSetterMapping(java.lang.Class methodOwner, java.lang.String methodName, java.lang.String columnName)
createSetterMapping
in interface IObjectMappingFactory
public ISetterMapping createSetterMapping(java.lang.Class methodOwner, java.lang.String methodName, java.lang.String columnName, boolean isTableMapped)
createSetterMapping
in interface IObjectMappingFactory
public ISetterMapping createSetterMapping(java.lang.Class theClass, java.lang.String methodName, java.lang.Class parameterType, java.lang.String columnName) throws PersistenceException
createSetterMapping
in interface IObjectMappingFactory
PersistenceException
public ISetterMapping createSetterMapping(java.lang.Class theClass, java.lang.String methodName, java.lang.Class parameterType, java.lang.String columnName, boolean isTableMapped) throws PersistenceException
createSetterMapping
in interface IObjectMappingFactory
PersistenceException
public ISetterMapping createSetterMapping(java.lang.reflect.Method member, java.lang.String columnName, boolean isTableMapped)
IObjectMappingFactory
Method
, database column name, and
isTableMapped values prefilled. The setter method mapping will be of a type matching the class
of setter methods parameter.
createSetterMapping
in interface IObjectMappingFactory
member
- The setter method
to map from.columnName
- 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.public ISetterMapping copySetterMapping(ISetterMapping source)
IObjectMappingFactory
ISetterMapping
instance. Changing the copy will not affect the original.
copySetterMapping
in interface IObjectMappingFactory
source
- The ISetterMapping
instance to copy.
ISetterMapping
that is equal to the original.public void addGetterMapping(IObjectMapping mapping, java.lang.String methodName, java.lang.String columnName, boolean isTableMapped) throws java.lang.NoSuchMethodException, PersistenceException
IObjectMappingFactory
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.
addGetterMapping
in interface IObjectMappingFactory
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
).public void addGetterMapping(IObjectMapping mapping, java.lang.String methodName, java.lang.String columnName, boolean isTableMapped, boolean isPrimaryKey, boolean isAutoGenerated) throws java.lang.NoSuchMethodException, PersistenceException
IObjectMappingFactory
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.
addGetterMapping
in interface IObjectMappingFactory
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
).public void addSetterMapping(IObjectMapping mapping, java.lang.String methodName, java.lang.String columnName, boolean isTableMapped) throws java.lang.NoSuchMethodException, PersistenceException
IObjectMappingFactory
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.
addSetterMapping
in interface IObjectMappingFactory
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
).public void addSetterMapping(IObjectMapping mapping, java.lang.String methodName, java.lang.String columnName, boolean isTableMapped, boolean isPrimaryKey) throws java.lang.NoSuchMethodException, PersistenceException
IObjectMappingFactory
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.
addSetterMapping
in interface IObjectMappingFactory
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
).public void addSetterMapping(IObjectMapping mapping, java.lang.String methodName, java.lang.Class parameterType, java.lang.String columnName, boolean isTableMapped) throws java.lang.NoSuchMethodException, PersistenceException
IObjectMappingFactory
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.
addSetterMapping
in interface IObjectMappingFactory
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
).public 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
IObjectMappingFactory
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.
addSetterMapping
in interface IObjectMappingFactory
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
).public IKey createKey()
IObjectMappingFactory
IKey
instance. Key instances are used
to represent database keys. For instance primary keys and foreign keys.
createKey
in interface IObjectMappingFactory
protected java.lang.Class getMemberType(java.lang.reflect.Method method)
protected void assureObjectClass(IObjectMapping mapping) throws PersistenceException
PersistenceException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |