QueryArgType - the type of the actual input of the query for the
data retrieval process. Note that this type is recommended to be immutable
or effectively immutable.public final class CachedLinkRequest<QueryArgType> extends Object
AsyncDataLink providing should
be cached. The request is intended to passed to an AsyncDataQuery as
an input.
Apart from the input of the query, the request contains an timeout value
after the cached AsyncDataLink becomes invalid and should be
recreated when needed again.
input of the query can possibly be mutable. Note
however that it is recommended that this input be immutable as well making
instances of this class completely immutable.
| Constructor and Description |
|---|
CachedLinkRequest(QueryArgType queryArg)
Creates and initializes the
CachedLinkRequest with the given
input for the query and one hour as the
cache expire timeout value. |
CachedLinkRequest(QueryArgType queryArg,
long cacheExpire,
TimeUnit timeunit)
Creates and initializes the
CachedLinkRequest with the given
input for the query and the cache expire timeout value. |
| Modifier and Type | Method and Description |
|---|---|
long |
getCacheExpire(TimeUnit timeunit)
Returns the timeout value in the given time unit after an
AsyncDataLink requested by this request becomes invalid and must
be recreated. |
QueryArgType |
getQueryArg()
Returns the object used as the input of the query of the data.
|
String |
toString()
Returns the string representation of this
CachedLinkRequest in no
particular format. |
public CachedLinkRequest(QueryArgType queryArg)
CachedLinkRequest with the given
input for the query and one hour as the
cache expire timeout value.queryArg - the object used as the input of the
AsyncDataQuery to retrieve the requested data. This argument
can be null if the query accepts null values as its
input.public CachedLinkRequest(QueryArgType queryArg, long cacheExpire, TimeUnit timeunit)
CachedLinkRequest with the given
input for the query and the cache expire timeout value.queryArg - the object used as the input of the
AsyncDataQuery to retrieve the requested data. This argument
can be null if the query accepts null values as its
input.cacheExpire - the time in the given unit after the
AsyncDataLink instance created using this request becomes
invalid and should be recreated. This argument must be greater than or
equal to zero.timeunit - the time unit of the cacheExpire argument.
This argument cannot be null.IllegalArgumentException - thrown if cacheExpire < 0NullPointerException - thrown if timeunit is nullpublic long getCacheExpire(TimeUnit timeunit)
AsyncDataLink requested by this request becomes invalid and must
be recreated.timeunit - the time unit in which the timeout value is to be
returned. This argument cannot be null.AsyncDataLink requested by this request becomes invalid and
must be recreated. This method always returns a value greater than or
equal to zero.public QueryArgType getQueryArg()
null if null was passed in the
constructor.public String toString()
CachedLinkRequest in no
particular format.
This method is intended to be used for debugging only.