|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object de.mathema.pride.ExtendedAttributeDescriptor
public class ExtendedAttributeDescriptor
Field Summary | |
---|---|
protected java.lang.reflect.Method |
conversionMethod
|
protected int |
databaseColumnType
|
protected java.lang.String |
databaseFieldName
|
protected java.lang.reflect.Method |
databaseGetByIndexMethod
Method to fetch data from a database result set by index |
protected java.lang.reflect.Method |
databaseGetByNameMethod
Method to fetch data from a database result set by name |
protected java.lang.reflect.Method |
databaseSetMethod
Method to store data in a database prepared statement |
protected java.lang.Class<java.lang.Enum> |
enumType
True if the attribute represented by this descriptor is an enumeration type |
protected int |
extractionMode
Specifies the ResultSet data extraction mode. |
protected java.lang.reflect.Method |
getMethod
|
protected boolean |
isPrimitive
True if the attribute represented by this descriptor is of a primitive type |
static java.lang.String |
REVISION_ID
|
protected java.lang.reflect.Method |
setMethod
|
Fields inherited from interface de.mathema.pride.SQLExpression.Operator |
---|
BETWEEN, EQUAL, GREATER, GREATEREQUAL, IN, LESS, LESSEQUAL, LIKE, NOTIN, UNEQUAL |
Fields inherited from interface de.mathema.pride.RecordDescriptor.ExtractionMode |
---|
AUTO, INDEX, NAME |
Constructor Summary | |
---|---|
ExtendedAttributeDescriptor(java.lang.Class objectType,
java.lang.String[] attrInfo,
int extractionMode)
|
Method Summary | |
---|---|
void |
applyResult(java.lang.Object obj,
java.lang.String stringValue)
|
int |
getColumnType(java.sql.Connection con,
java.lang.String table)
Retrieve the column's SQL type, required for setting NULL values in prepared statements. |
protected static java.lang.reflect.Method |
getConversionMethod(java.lang.Class destinationType)
|
java.lang.String |
getCreationValue(java.lang.Object obj,
Database db)
Returns a string representation of the passed object's value for this descriptor's attribute. |
java.lang.String |
getFieldName()
Returns the database field name |
int |
getParameter(java.lang.Object obj,
PreparedOperation pop,
java.lang.String table,
int position)
Writes an attribute of the passed value object to a PreparedOperation |
java.lang.String |
getUpdateValue(java.lang.Object obj,
Database db)
Returns an update expression of the form " |
java.lang.Object |
getValue(java.lang.Object obj)
Returns the object's value for this attribute |
java.lang.String |
getWhereValue(java.lang.Object obj,
Database db,
boolean byLike)
Returns a constraint expression of the form " |
protected void |
record2object(java.lang.Object obj,
java.sql.ResultSet results,
int position)
Fetch a value from a database result set and copy it into an object according to this attribute descriptor |
protected java.lang.Object |
record2object(java.sql.ResultSet results,
int position)
Fetch a value from a database result set according to this descriptor's extraction mode. |
protected int |
selectDataType(java.sql.Connection con,
java.lang.String table,
java.lang.String column)
|
protected static void |
setConversionMethods()
|
protected java.lang.Object |
wrapArrayTypedValue(java.sql.Connection connection,
java.lang.Object attrValue)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected java.lang.reflect.Method conversionMethod
public static final java.lang.String REVISION_ID
protected java.lang.String databaseFieldName
protected int databaseColumnType
protected java.lang.reflect.Method databaseGetByNameMethod
protected java.lang.reflect.Method databaseGetByIndexMethod
protected java.lang.reflect.Method databaseSetMethod
protected java.lang.reflect.Method getMethod
protected java.lang.reflect.Method setMethod
protected int extractionMode
RecordDescriptor
for details.
protected boolean isPrimitive
protected java.lang.Class<java.lang.Enum> enumType
Constructor Detail |
---|
public ExtendedAttributeDescriptor(java.lang.Class objectType, java.lang.String[] attrInfo, int extractionMode) throws IllegalDescriptorException
IllegalDescriptorException
Method Detail |
---|
protected static void setConversionMethods() throws java.lang.NoSuchMethodException
java.lang.NoSuchMethodException
protected static java.lang.reflect.Method getConversionMethod(java.lang.Class destinationType) throws java.lang.NoSuchMethodException
java.lang.NoSuchMethodException
public void applyResult(java.lang.Object obj, java.lang.String stringValue) throws java.lang.IllegalAccessException, java.lang.reflect.InvocationTargetException
java.lang.IllegalAccessException
java.lang.reflect.InvocationTargetException
public java.lang.String getFieldName()
public int getColumnType(java.sql.Connection con, java.lang.String table) throws java.sql.SQLException
con
- the database connection to fetch meta data fromtable
- the database table to fetch the column type from.
The function assumes that the type is equal in all tables making
use of the same attribute descriptor (e.g. all tables of a
descriptor derivation hierarchy).
java.sql.SQLException
- if meta data retrieval failedprotected int selectDataType(java.sql.Connection con, java.lang.String table, java.lang.String column) throws java.sql.SQLException
java.sql.SQLException
public java.lang.Object getValue(java.lang.Object obj) throws java.lang.IllegalAccessException, java.lang.reflect.InvocationTargetException
java.lang.IllegalAccessException
java.lang.reflect.InvocationTargetException
public java.lang.String getUpdateValue(java.lang.Object obj, Database db) throws java.lang.IllegalAccessException, java.lang.reflect.InvocationTargetException
java.lang.IllegalAccessException
java.lang.reflect.InvocationTargetException
public java.lang.String getWhereValue(java.lang.Object obj, Database db, boolean byLike) throws java.lang.IllegalAccessException, java.lang.reflect.InvocationTargetException
java.lang.IllegalAccessException
java.lang.reflect.InvocationTargetException
protected java.lang.Object record2object(java.sql.ResultSet results, int position) throws java.lang.reflect.InvocationTargetException, java.lang.IllegalAccessException
results
- The ResultSet to extract data fromposition
- The index of the field to extract. Ignored in NAME mode.
Passsing -1 forces extraction by name.
java.lang.reflect.InvocationTargetException
java.lang.IllegalAccessException
protected void record2object(java.lang.Object obj, java.sql.ResultSet results, int position) throws java.sql.SQLException, java.lang.IllegalAccessException, java.lang.reflect.InvocationTargetException
java.sql.SQLException
java.lang.IllegalAccessException
java.lang.reflect.InvocationTargetException
public java.lang.String getCreationValue(java.lang.Object obj, Database db) throws java.lang.IllegalAccessException, java.lang.reflect.InvocationTargetException
java.lang.IllegalAccessException
java.lang.reflect.InvocationTargetException
public int getParameter(java.lang.Object obj, PreparedOperation pop, java.lang.String table, int position) throws java.lang.IllegalAccessException, java.lang.reflect.InvocationTargetException, java.sql.SQLException
PreparedOperation
obj
- the value object to read frompop
- the PreparedOperation
to write totable
- the name of the database table, the operation refers to.
This is only required in case of NULL attribute values, which require
to retrieve the column type first. This is a nasty detail in the JDBC
API which we must take care of. Some databases allow just to set type
NULL in this case, but especially DB2 and Oracle do not. See method
PreparedStatement.setNull(int, int)
for further details.position
- index of the parameter in the prepared statement to write
java.lang.IllegalAccessException
java.lang.reflect.InvocationTargetException
java.sql.SQLException
protected java.lang.Object wrapArrayTypedValue(java.sql.Connection connection, java.lang.Object attrValue) throws java.sql.SQLException
java.sql.SQLException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |