com.google.api.ads.admanager.lib.utils.QueryBuilderInterface Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of ads-lib Show documentation
Show all versions of ads-lib Show documentation
Client library for Java for accessing ads APIs including DFP.
If you want to use this library, you must also include another Maven
artifact to specify which framework you would like to use it with. For
example, to use DFP with Axis, you should include the "dfp-axis"
artifact.
// Copyright 2012 Google Inc. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package com.google.api.ads.admanager.lib.utils;
import java.util.Map;
/**
* {@code QueryBuilderInterface} allows for queries to be constructed in parts.
*
* @param the type of the API Value
*/
public interface QueryBuilderInterface {
/**
* Sets the statement SELECT clause in the form of "a,b" or "*".
* Only necessary for statements being sent to the
* {@code PublisherQueryLanguageService}. The "SELECT " keyword will be
* ignored.
*
* @param columns the statement select clause without "SELECT"
* @return a reference to this object
*/
QueryBuilderInterface select(String columns);
/**
* Sets the statement FROM clause in the form of "table".
* Only necessary for statements being sent to the
* {@code PublisherQueryLanguageService}. The "FROM " keyword will be
* ignored.
*
* @param table the statement from clause without "FROM"
* @return a reference to this object
*/
QueryBuilderInterface from(String table);
/**
* Sets the statement WHERE clause in the form of
* "WHERE <condition> {[AND | OR] <condition> ...}"
*
* e.g. "a = b OR b = c". The "WHERE " keyword will be ignored.
* @param conditions the statement query without "WHERE"
* @return a reference to this object
*/
QueryBuilderInterface where(String conditions);
/**
* Sets the statement LIMIT clause in the form of
* "LIMIT <count>"
*
* e.g. 1000.
* @param count the statement limit
* @return a reference to this object
*/
QueryBuilderInterface limit(Integer count);
/**
* Sets the statement OFFSET clause in the form of
* "OFFSET <count>"
*
* e.g. 200.
* @param count the statement offset
* @return a reference to this object
*/
QueryBuilderInterface offset(Integer count);
/**
* Increases the offset by the {@code amount}.
* @param amount the amount to increase the offset
* @return a reference to this object
*/
QueryBuilderInterface increaseOffsetBy(Integer amount);
/**
* Gets the current offset.
* @return the current offset
*/
Integer getOffset();
/**
* Removes the limit and offset from the query.
* @return a reference to this object
*/
QueryBuilderInterface removeLimitAndOffset();
/**
* Sets the statement ORDER BY clause in the form of
* "ORDER BY <property> [ASC | DESC]"
*
* e.g. "type ASC, lastModifiedDateTime DESC". The "ORDER BY " keyword will be
* ignored.
* @param orderBy the statement order by without "ORDER BY"
* @return a reference to this object
*/
QueryBuilderInterface orderBy(String orderBy);
/**
* Puts a key-value into the bind variables.
*/
QueryBuilderInterface withBindVariableValue(String key, V value);
/**
* Gets an unmodifiable key-value map.
*/
Map getBindVariableMap();
/**
* Builds the query from the clauses.
* @return the constructed query
*/
String buildQuery();
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy