T - data typeX - target typepublic abstract class FieldExpression<T,X extends DataObject> extends java.lang.Object implements FieldSQLExpression<T,X>
| Modifier and Type | Field and Description |
|---|---|
protected java.lang.Class<X> |
filter_type |
static Feature |
LOG_FETCH |
protected java.lang.String |
name |
protected Repository |
repository |
protected java.lang.Class<T> |
target |
| Modifier | Constructor and Description |
|---|---|
protected |
FieldExpression(java.lang.Class<X> filter_type,
Repository repository,
java.lang.Class<T> target,
java.lang.String name) |
| Modifier and Type | Method and Description |
|---|---|
int |
add(java.lang.StringBuilder sb,
boolean qualify)
Add the expression to a StringBuilder
|
boolean |
canSet()
does this
Accessor support setting values. |
boolean |
equals(java.lang.Object obj) |
java.lang.String |
getFieldName()
Get the corresponding field name.
|
java.lang.Class<X> |
getFilterType() |
java.util.List<PatternArgument> |
getParameters(java.util.List<PatternArgument> list)
Add parameters for this value to a list.
|
SQLFilter |
getRequiredFilter()
Get an SQLFilter required to be added to the filter set.
|
java.lang.Class<T> |
getTarget()
Get the type of the returned object as far as it is known.
|
protected abstract T |
getValue(Repository.Record r) |
T |
getValue(X r)
get the value from the target object
|
int |
hashCode() |
T |
makeObject(java.sql.ResultSet rs,
int pos)
Extract a result of the expression from a ResultSet into an object of the specified type.
|
void |
setObject(java.sql.PreparedStatement stmt,
int pos,
T value)
Add an object of the target type to a prepared statement doing any necessary type conversion
to map it to the SQL representation of the object (as generated by
FieldValue.addField(StringBuilder, boolean)
Note this is only valid if canSet from SQLAccessor returns true. |
protected abstract void |
setValue(Repository.Record r,
T value) |
void |
setValue(X r,
T value)
Set value if supported otherwise throw a
UnsupportedOperationException. |
java.lang.String |
toString() |
clone, finalize, getClass, notify, notifyAll, wait, wait, waitaddFieldaddGroup, checkContentsCanGroup, getGroupParameters, groupingIsomorphicgroupingIsomorphicpublic static final Feature LOG_FETCH
protected final Repository repository
protected final java.lang.String name
protected final java.lang.Class<T> target
protected final java.lang.Class<X extends DataObject> filter_type
protected FieldExpression(java.lang.Class<X> filter_type, Repository repository, java.lang.Class<T> target, java.lang.String name)
public int add(java.lang.StringBuilder sb,
boolean qualify)
SQLValuepublic T makeObject(java.sql.ResultSet rs, int pos) throws DataException, java.sql.SQLException
SQLValuemakeObject in interface SQLValue<T>rs - ResultSetDataExceptionjava.sql.SQLExceptionpublic final java.lang.Class<T> getTarget()
Targettedpublic java.lang.String getFieldName()
FieldValuegetFieldName in interface FieldValue<T,X extends DataObject>public void setObject(java.sql.PreparedStatement stmt,
int pos,
T value)
throws java.sql.SQLException
FieldValueFieldValue.addField(StringBuilder, boolean)
Note this is only valid if canSet from SQLAccessor returns true.setObject in interface FieldValue<T,X extends DataObject>java.sql.SQLExceptionpublic java.lang.String toString()
toString in class java.lang.Objectpublic SQLFilter getRequiredFilter()
SQLValuegetRequiredFilter in interface SQLValue<T>public java.util.List<PatternArgument> getParameters(java.util.List<PatternArgument> list)
SQLValuegetParameters in interface SQLValue<T>list - to modifypublic boolean canSet()
AccessorAccessor support setting values.canSet in interface Accessor<T,X extends DataObject>protected abstract T getValue(Repository.Record r)
public final T getValue(X r)
AccessorgetValue in interface Accessor<T,X extends DataObject>r - target objectprotected abstract void setValue(Repository.Record r, T value)
public final void setValue(X r, T value)
AccessorUnsupportedOperationException.setValue in interface Accessor<T,X extends DataObject>public final java.lang.Class<X> getFilterType()
public int hashCode()
hashCode in interface SQLExpression<T>hashCode in class java.lang.Objectpublic boolean equals(java.lang.Object obj)
equals in interface SQLExpression<T>equals in class java.lang.Object