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, wait
addField
addGroup, checkContentsCanGroup, getGroupParameters, groupingIsomorphic
groupingIsomorphic
public 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)
SQLValue
public T makeObject(java.sql.ResultSet rs, int pos) throws DataException, java.sql.SQLException
SQLValue
makeObject
in interface SQLValue<T>
rs
- ResultSetDataException
java.sql.SQLException
public final java.lang.Class<T> getTarget()
Targetted
public java.lang.String getFieldName()
FieldValue
getFieldName
in interface FieldValue<T,X extends DataObject>
public void setObject(java.sql.PreparedStatement stmt, int pos, T value) throws java.sql.SQLException
FieldValue
FieldValue.addField(StringBuilder, boolean)
Note this is only valid if canSet from SQLAccessor
returns true.setObject
in interface FieldValue<T,X extends DataObject>
java.sql.SQLException
public java.lang.String toString()
toString
in class java.lang.Object
public SQLFilter getRequiredFilter()
SQLValue
getRequiredFilter
in interface SQLValue<T>
public java.util.List<PatternArgument> getParameters(java.util.List<PatternArgument> list)
SQLValue
getParameters
in interface SQLValue<T>
list
- to modifypublic boolean canSet()
Accessor
Accessor
support setting values.canSet
in interface Accessor<T,X extends DataObject>
protected abstract T getValue(Repository.Record r)
public final T getValue(X r)
Accessor
getValue
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)
Accessor
UnsupportedOperationException
.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.Object
public boolean equals(java.lang.Object obj)
equals
in interface SQLExpression<T>
equals
in class java.lang.Object