Package com.kii.cloud.storage.query
Class KiiQuery
- java.lang.Object
-
- com.kii.cloud.storage.query.KiiQuery
-
public class KiiQuery extends java.lang.Object
Query interface used for query data on KiiCloud.
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static KiiQuery
copy(KiiQuery query)
create new instance and copy all fields.static KiiQuery
create(java.lang.String queryString)
Create Query from String.void
setLimit(int limit)
Set the maximum number of results returned on response.void
sortByAsc(java.lang.String key)
Sort with the specified key in ascending order.
If the key has different type of values, (ex.void
sortByDesc(java.lang.String key)
Sort with the specified key in descending order.
If the key has different type of values, (ex.java.lang.String
toString()
-
-
-
Constructor Detail
-
KiiQuery
public KiiQuery(@Nullable KiiClause clause)
Create Query from theKiiClause
.- Parameters:
clause
- query condition to be applied. if null, all clause which matches all records in the bucket applied.
-
KiiQuery
public KiiQuery()
Create Query. Matches all records in the bucket.
-
-
Method Detail
-
copy
public static KiiQuery copy(@NonNull KiiQuery query)
create new instance and copy all fields.- Parameters:
query
- source instance- Returns:
- copied new instance
-
create
@NonNull public static KiiQuery create(@Nullable java.lang.String queryString)
Create Query from String. You may not use this method. It is introduced for internal use.- Parameters:
queryString
- Should be raw JSON String conforms to Kii Cloud bucket query REST interface.
-
sortByDesc
public void sortByDesc(@NonNull java.lang.String key)
Sort with the specified key in descending order.
If the key has different type of values, (ex. there exists key "amount":100 (int) and "amount":"100" (String)), results will be sorted separately for each type. Order of type is undefined. Mixing different types in same key is not praised.- Parameters:
key
- used for sort.
-
sortByAsc
public void sortByAsc(@NonNull java.lang.String key)
Sort with the specified key in ascending order.
If the key has different type of values, (ex. there exists key "amount":100 (int) and "amount":"100" (String)), results will be sorted separately for each type. Order of type is undefined. Mixing different types in same key is not praised.- Parameters:
key
- used for sort.
-
setLimit
public void setLimit(int limit)
Set the maximum number of results returned on response. This limit behaves in a best effort way, actual number of
returned result may be different with that of requested number.
Server will try to recover the number of objects requested and it will
succeed if the limit is not higher than the maximum page size supported by the server.
If the limit is higher, the number of objects returned will be the maximum page size.- Parameters:
limit
- Maximum return items. If specified limit is <= 0, 0 will be applied. If the specified limit is greater than the limit of the server or limit is set to 0, limit defined in server will be applied.
-
toString
@NonNull public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-