|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.google.gdata.client.Query
public class Query
The Query class is a helper class that aids in the construction of a GData query. It provides a simple API and object model that exposes query parameters. Once constructed, the query can be executed against a GData service.
The Query class also acts as a simple base class for GData services that support custom query parameters. These services can subclass the base Query class, add APIs to represent service query parameters, and participate in the Query URI generation process.
Service.query(Query, Class)
Nested Class Summary | |
---|---|
static class |
Query.CategoryFilter
The CategoryFilter class is used to define sets of category conditions that must be met in order for an entry to match. |
static class |
Query.CustomParameter
The CustomParameter class defines a base representation for custom query parameters. |
static class |
Query.ResultFormat
Defines all query return formats. |
Field Summary | |
---|---|
static int |
UNDEFINED
Magic value indicating that a numeric field is not set. |
Constructor Summary | |
---|---|
Query(java.net.URL feedUrl)
Constructs a new Query object that targets a feed. |
Method Summary | |
---|---|
void |
addCategoryFilter(Query.CategoryFilter categoryFilter)
Adds a new CategoryFilter to the query. |
void |
addCustomParameter(Query.CustomParameter customParameter)
Adds a new CustomParameter. |
protected void |
appendQueryParameter(java.lang.StringBuilder queryBuf,
java.lang.String paramName,
java.lang.String paramValue)
Appends specified query (parameter, value) to provided query URL buffer. |
java.lang.String |
getAuthor()
Returns the author name or email address used for the query. |
java.util.List<Query.CategoryFilter> |
getCategoryFilters()
Returns the current list of CategoryFilters associated with the query. |
java.util.List<Query.CustomParameter> |
getCustomParameters()
Returns the list of custom parameters. |
java.util.List<Query.CustomParameter> |
getCustomParameters(java.lang.String name)
Returns the list of custom parameters that match a specified name. |
java.net.URL |
getFeedUrl()
Returns the feed URL of this query. |
java.lang.String |
getFullTextQuery()
Returns the full text query string that will be used for the query. |
java.lang.Integer |
getIntegerCustomParameter(java.lang.String name)
Gets an existing Integer custom paramter, with null signifying that the parameter is not specified or not an integer. |
int |
getMaxResults()
Returns the maximum number of results to return for the query, or UNDEFINED if max results has not been set. |
DateTime |
getPublishedMax()
Returns the maximum published timestamp used for this query. |
DateTime |
getPublishedMin()
Returns the minimum published timestamp used for this query. |
java.net.URI |
getQueryUri()
Returns the relative query URI that represents only the query parameters without any components related to the target feed. |
Query.ResultFormat |
getResultFormat()
Returns the query result format. |
int |
getStartIndex()
Returns the current start index value for the query, or UNDEFINED if start index has not been set. |
java.lang.String |
getStringCustomParameter(java.lang.String name)
Gets an existing String custom parameter, with null signifying that the parameter is not specified. |
DateTime |
getUpdatedMax()
Returns the maximum updated timestamp used for this query. |
DateTime |
getUpdatedMin()
Returns the minimum updated timestamp used for this query. |
java.net.URL |
getUrl()
Returns the Query URL that encapsulates the current state of this query object. |
boolean |
isStrict()
Returns the strictness setting for query parameter parsing on the server. |
boolean |
isValidState()
Check if current query state is supported. |
void |
setAuthor(java.lang.String author)
Sets the author name or email address used for the query. |
void |
setFullTextQuery(java.lang.String query)
Sets the full text query string that will be used for the query. |
void |
setIntegerCustomParameter(java.lang.String name,
java.lang.Integer value)
Sets an integer custom paramter, with null signifying to clear the parameter. |
void |
setMaxResults(int maxResults)
Sets the maximum number of results to return for the query. |
void |
setPublishedMax(DateTime publishedMax)
Sets the maximum published timestamp used for the query. |
void |
setPublishedMin(DateTime publishedMin)
Sets the minimum published timestamp used for the query. |
void |
setResultFormat(Query.ResultFormat resultFormat)
Sets the expected query result format. |
void |
setStartIndex(int startIndex)
Sets the start index for query results. |
void |
setStrict(boolean strict)
Sets the strictness of parameter parsing. |
void |
setStringCustomParameter(java.lang.String name,
java.lang.String value)
Sets a string custom parameter, with null signifying to clear the parameter. |
void |
setUpdatedMax(DateTime updatedMax)
Sets the maximum updated timestamp used for the query. |
void |
setUpdatedMin(DateTime updatedMin)
Sets the minimum updated timestamp used for the query. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int UNDEFINED
Constructor Detail |
---|
public Query(java.net.URL feedUrl)
feedUrl
- the URL of the feed against which queries will be
executed.Method Detail |
---|
public java.net.URL getFeedUrl()
public void setFullTextQuery(java.lang.String query)
query
- the full text search query string. A value of
null
disables full text search for this Query.public java.lang.String getFullTextQuery()
public void addCategoryFilter(Query.CategoryFilter categoryFilter)
public java.util.List<Query.CategoryFilter> getCategoryFilters()
public void setAuthor(java.lang.String author)
author
- the name or email address for matched entries. A value of
null
disables author-based matching.public java.lang.String getAuthor()
null
means no author-based matching.public void setUpdatedMin(DateTime updatedMin)
updatedMin
- minimum updated timestamp for matched entries. A value
of null
disables minimum timestamp filtering.public DateTime getUpdatedMin()
null
indicates no minimum timestamp.public void setUpdatedMax(DateTime updatedMax)
updatedMax
- maximum updated timestamp for matched entries. A value
of null
disables maximum timestamp filtering.public DateTime getUpdatedMax()
null
indicates no maximum timestamp.public void setPublishedMin(DateTime publishedMin)
publishedMin
- minimum published timestamp for matched entries. A
value of null
disables minimum timestamp filtering.public DateTime getPublishedMin()
null
indicates no minimum timestamp.public void setPublishedMax(DateTime publishedMax)
publishedMax
- maximum published timestamp for matched entries. A
value of null
disables maximum timestamp filtering.public DateTime getPublishedMax()
null
indicates no maximum timestamp.public void setStartIndex(int startIndex)
startIndex
- the start index for query results.
java.lang.IllegalArgumentException
- if index is less than or equal to zero.public int getStartIndex()
UNDEFINED
if start index has not been set.
public void setMaxResults(int maxResults)
maxResults
- the maximum number of results to return for the query.
A value of zero indicates that the server is free
to determine the maximum value.
java.lang.IllegalArgumentException
- if the provided value is less than zero.public int getMaxResults()
UNDEFINED
if max results has not been set.
Note: a GData server may choose to provide fewer results, but will never provide more than the requested maximum.
public void setResultFormat(Query.ResultFormat resultFormat)
resultFormat
- ResultFormat value indicating the desired format.public Query.ResultFormat getResultFormat()
public void setStrict(boolean strict)
strict
- true if strict parsing should be enabled for this query.public boolean isStrict()
public void addCustomParameter(Query.CustomParameter customParameter)
customParameter
- the new custom parameter to add.public java.util.List<Query.CustomParameter> getCustomParameters()
public java.util.List<Query.CustomParameter> getCustomParameters(java.lang.String name)
name
- the name value to match for returned parameters.
protected void appendQueryParameter(java.lang.StringBuilder queryBuf, java.lang.String paramName, java.lang.String paramValue) throws java.io.UnsupportedEncodingException
queryBuf
- base URI buffer to append to.paramName
- query parameter name.paramValue
- query parameter value.
java.io.UnsupportedEncodingException
public boolean isValidState()
true
if supported.public java.net.URI getQueryUri()
public java.net.URL getUrl()
public final void setStringCustomParameter(java.lang.String name, java.lang.String value)
name
- the name of the parametervalue
- the value to set it topublic final java.lang.String getStringCustomParameter(java.lang.String name)
name
- the name of the parameter
public final void setIntegerCustomParameter(java.lang.String name, java.lang.Integer value)
name
- the parameter namevalue
- the value to set it topublic final java.lang.Integer getIntegerCustomParameter(java.lang.String name)
name
- the name of the parameter
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |