X - public class DurationFieldValue<X extends DataObject> extends java.lang.Object implements SQLAccessor<Duration,X>, FilterProvider<X,Duration>
NumberFieldExpression into
an SQLAccessor for a Duration with a configurable resolution.
Note that NumberFieldExpression can implement Duration directly
(as a SQLExpression if millisecond resolution is used as Duration is a number.
This class is only a SQLValue as the database resolution is different from the numerical
value of the Duration.| Modifier and Type | Field and Description |
|---|---|
protected NumberFieldExpression<java.lang.Number,X> |
expression |
protected long |
resolution |
| Constructor and Description |
|---|
DurationFieldValue(NumberFieldExpression<java.lang.Number,X> expression,
long resolution)
convert a
NumberFieldExpression into a DurationFieldValue |
| 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. |
java.lang.String |
getFieldName() |
SQLFilter<X> |
getFilter(MatchCondition match,
Duration val)
Create a
SQLFilter comparing against the target value |
java.lang.Class<X> |
getFilterType()
get the type bounds on the produced
SQLFilter. |
SQLFilter<X> |
getNullFilter(boolean is_null)
create a
SQLFilter checking if the target value is or is not null. |
SQLFilter<X> |
getOrderFilter(boolean descending)
create a
SQLFilter that orders results by the target value. |
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<Duration> |
getTarget()
Get the type of the returned object as far as it is known.
|
Duration |
getValue(X r)
get the value from the target object
|
Duration |
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,
Duration value) |
void |
setValue(X rec,
Duration duration)
Set value if supported otherwise throw a
UnsupportedOperationException. |
java.lang.String |
toString() |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitaddGroup, checkContentsCanGroup, getGroupParameters, groupingIsomorphicprotected final NumberFieldExpression<java.lang.Number,X extends DataObject> expression
protected final long resolution
public DurationFieldValue(NumberFieldExpression<java.lang.Number,X> expression, long resolution)
NumberFieldExpression into a DurationFieldValueexpression - underlying expressionresolution - resolution of stored value in milliseconds.public java.lang.Class<Duration> getTarget()
Targettedpublic Duration getValue(X r)
AccessorgetValue in interface Accessor<Duration,X extends DataObject>r - target objectpublic int add(java.lang.StringBuilder sb,
boolean qualify)
SQLValuepublic java.util.List<PatternArgument> getParameters(java.util.List<PatternArgument> list)
SQLValuegetParameters in interface SQLValue<Duration>list - to modifypublic Duration makeObject(java.sql.ResultSet rs, int pos) throws DataException, java.sql.SQLException
SQLValuemakeObject in interface SQLValue<Duration>rs - ResultSetDataExceptionjava.sql.SQLExceptionpublic void setValue(X rec, Duration duration)
AccessorUnsupportedOperationException.setValue in interface Accessor<Duration,X extends DataObject>public void setObject(java.sql.PreparedStatement stmt,
int pos,
Duration value)
throws java.sql.SQLException
java.sql.SQLExceptionpublic java.lang.String getFieldName()
public java.lang.String toString()
toString in class java.lang.Objectpublic SQLFilter getRequiredFilter()
SQLValuegetRequiredFilter in interface SQLValue<Duration>public boolean canSet()
AccessorAccessor support setting values.canSet in interface Accessor<Duration,X extends DataObject>public SQLFilter<X> getFilter(MatchCondition match, Duration val) throws CannotFilterException
FilterProviderSQLFilter comparing against the target valuegetFilter in interface FilterProvider<X extends DataObject,Duration>SQLFilterCannotFilterExceptionpublic SQLFilter<X> getNullFilter(boolean is_null) throws CannotFilterException
FilterProviderSQLFilter checking if the target value is or is not null.getNullFilter in interface FilterProvider<X extends DataObject,Duration>SQLFilterCannotFilterExceptionpublic SQLFilter<X> getOrderFilter(boolean descending) throws CannotFilterException
FilterProviderSQLFilter that orders results by the target value. This may involve joins so
may not be just an OrderFilter though it will contain one.getOrderFilter in interface FilterProvider<X extends DataObject,Duration>SQLFilterCannotFilterExceptionpublic java.lang.Class<X> getFilterType()
FilterProviderSQLFilter.getFilterType in interface FilterProvider<X extends DataObject,Duration>