com.jenkov.mrpersister.itf.mapping
Interface IMethodMapping

All Known Subinterfaces:
IGetterMapping, ISetterMapping
All Known Implementing Classes:
ArrayGetterMapping, ArraySetterMapping, AsciiStreamGetterMapping, AsciiStreamSetterMapping, BigDecimalGetterMapping, BigDecimalSetterMapping, BinaryStreamGetterMapping, BinaryStreamSetterMapping, BlobGetterMapping, BlobSetterMapping, BooleanGetterMapping, BooleanSetterMapping, ByteArrayGetterMapping, ByteArraySetterMapping, ByteGetterMapping, ByteSetterMapping, CalendarGetterMapping, CalendarSetterMapping, CharacterStreamGetterMapping, CharacterStreamSetterMapping, ClobGetterMapping, ClobSetterMapping, DateGetterMapping, DateSetterMapping, DoubleGetterMapping, DoubleSetterMapping, FloatGetterMapping, FloatSetterMapping, GetterMapping, IntGetterMapping, IntSetterMapping, LongGetterMapping, LongSetterMapping, MethodMapping, ObjectGetterMapping, ObjectSetterMapping, RefGetterMapping, RefSetterMapping, SetterMapping, ShortGetterMapping, ShortSetterMapping, SqlDateGetterMapping, SqlDateSetterMapping, StringGetterMapping, StringSetterMapping, TimeGetterMapping, TimeSetterMapping, TimestampGetterMapping, TimestampSetterMapping, UrlGetterMapping, UrlSetterMapping

public interface IMethodMapping

This interface represents the functions that both IGetterMapping and ISetterMapping instances have in common (it is the super-interface of both).

A method method maps a method in a class (getter or setter) to a column name in a table in the database.

Field mappings are stored in the object mappings and used by the object reader and object writer to determine what columns from the database to read and write. They are also used by the SQL generator to generate the SQL to read and write the objects.

Author:
Jakob Jenkov, Jenkov Development

Method Summary
 java.lang.String getColumnName()
          Returns the database table column name this method method is method to.
 int getColumnType()
          Returns the column type as defined in the database.
 java.lang.reflect.Method getObjectMethod()
          Returns the method instance this method method is method from.
 boolean isPrimaryKey()
          Deprecated. This method doesn't properly support compound keys. The method sends a signal about if this method mapping is a primary key mapping by itself. With the new compound key facilities a primary key may consist of more than one column. Use the public IKey IObjectMapping.getPrimaryKey() method to access the primary key of an object mapping's table.
 boolean isTableMapped()
          Returns true if the database column referenced by this method method exists in a table in the database.
 void setColumnName(java.lang.String fieldName)
          Sets the database column name this method method is method to.
 void setColumnType(int columnType)
          Sets the column type as defined in the database.
 void setObjectMethod(java.lang.reflect.Method member)
          The method instance this method method maps from.
 void setPrimaryKey(boolean isPrimaryKey)
          Deprecated. This method doesn't properly support compound keys. The method sends a signal about if this method mapping is a primary key mapping by itself. With the new compound key facilities a primary key may consist of more than one column. Use the public IKey IObjectMapping.getPrimaryKey() method to access the primary key of an object mapping's table.
 void setTableMapped(boolean isTableMapped)
          Sets whether or not the database column referenced by this method method exists in a table in the database.
 

Method Detail

getColumnName

java.lang.String getColumnName()
Returns the database table column name this method method is method to.

Returns:
The database table column name this method method is method to.

setColumnName

void setColumnName(java.lang.String fieldName)
Sets the database column name this method method is method to.

Parameters:
fieldName - The column name to map to.

getColumnType

int getColumnType()
Returns the column type as defined in the database. The int returned will match one of the java.sql.Types.XXX constants.

Returns:
The column type as defined in the database.

setColumnType

void setColumnType(int columnType)
Sets the column type as defined in the database. The int should match one of the java.sql.Types.XXX constants.

Parameters:
columnType - The column type as defined in the database.

getObjectMethod

java.lang.reflect.Method getObjectMethod()
Returns the method instance this method method is method from.

Returns:
The Method instance this method method is method from.

setObjectMethod

void setObjectMethod(java.lang.reflect.Method member)
The method instance this method method maps from.

Parameters:
member - The Method instance this method method maps from.

isPrimaryKey

boolean isPrimaryKey()
Deprecated. This method doesn't properly support compound keys. The method sends a signal about if this method mapping is a primary key mapping by itself. With the new compound key facilities a primary key may consist of more than one column. Use the public IKey IObjectMapping.getPrimaryKey() method to access the primary key of an object mapping's table.

Returns true if the database column referenced by this method method is the primary key of the table it comes from.

Returns:
True if the database column referenced by this method method is the primary key of the table it comes from. False if not.

setPrimaryKey

void setPrimaryKey(boolean isPrimaryKey)
Deprecated. This method doesn't properly support compound keys. The method sends a signal about if this method mapping is a primary key mapping by itself. With the new compound key facilities a primary key may consist of more than one column. Use the public IKey IObjectMapping.getPrimaryKey() method to access the primary key of an object mapping's table.

Sets whether or not the column referenced by this method method is the primary key.

Parameters:
isPrimaryKey - Set to true if the column referenced by this method method is the primary key of the table it comes from.

isTableMapped

boolean isTableMapped()
Returns true if the database column referenced by this method method exists in a table in the database. False if not. Objects can be mapped to SQL queries with arbitrary column names not existing in the database. For instance a setter method of an object can be mapped to the column name totalCount in the SQL query "select count(*) totalCount from employees

Returns:
True if the database column referenced by this method method exists in a table in the database. False if not.

setTableMapped

void setTableMapped(boolean isTableMapped)
Sets whether or not the database column referenced by this method method exists in a table in the database. Set to true if it does. False if not. Objects can be mapped to SQL queries with arbitrary column names not existing in the database. For instance a setter method of an object can be mapped to the column name totalCount in the SQL query "select count(*) totalCount from employees

Parameters:
isTableMapped -