public class CollectionFunctions extends AbstractFunctionHandler
| 限定符和类型 | 字段和说明 |
|---|---|
static String |
HANDLER_ID
The id that can be used to get the "CollectionFunctions" handler object from
the Query object.
|
q| 构造器和说明 |
|---|
CollectionFunctions() |
| 限定符和类型 | 方法和说明 |
|---|---|
List |
collect(Expression exp) |
List |
collect(List allobjs,
Expression exp) |
List |
collect(List objs,
Expression exp,
String saveValueName) |
int |
count(Expression exp) |
int |
count(List allobjs,
Expression exp) |
int |
count(List objs,
Expression exp,
Object value) |
List |
find(List objs,
Expression exp) |
List |
foreach(Expression exp) |
List |
foreach(Expression listFunction,
Expression exp) |
List |
foreach(List allobjs,
Expression exp) |
List |
foreach(List objs,
String exp) |
Object |
get(List l,
Number n) |
Object |
get(Map m,
Expression exp)
Get a value from the specified Map.
|
Map |
grp(List objs,
Expression exp)
Group objects from the List based upon the expression passed in.
|
Map |
map(List objs,
Expression exp)
Create a map of the objects passed in, the key will be the object in the list and
the value will be the result of calling the expression on the object.
|
Map |
map(List objs,
Expression keyExp,
Expression valExp) |
List |
sort(List objs)
Sort a list according to it's "natural" ordering (see
Collections.sort(List)). |
List |
sort(Map m)
Sort a Map by the keys in ascending order (for more optionality in the sort and ordering
see:
sort(Map,String,String)). |
List |
sort(Map m,
String type)
Sort a Map by it's keys or values in ascending order (for more optionality in the sort and ordering
see:
sort(Map,String,String)). |
List |
sort(Map m,
String type,
String dir) |
List |
toList(Expression exp) |
List |
toList(List allobjs,
Expression exp) |
List |
toList(List allobjs,
Expression exp,
String saveValueName) |
List |
unique(Expression exp) |
List |
unique(List objs) |
List |
unique(List objs,
Expression exp) |
setQuerypublic List sort(List objs)
Collections.sort(List)).objs - The list of objects to sort.public List sort(Map m)
sort(Map,String,String)).m - The map to sort.public List sort(Map m, String type)
sort(Map,String,String)).m - The map to sort.type - Should be either: "key" or "value" to indicate which item to sort on.
Use null for key.public Object get(Map m, Expression exp) throws QueryExecutionException
m - The map of objects.exp - The expression is evaluated (in the context of the current object) and the
value returned used as the key to the Map, the value it maps to
(which may be null) is returned.QueryExecutionExceptionpublic int count(List objs, Expression exp, Object value) throws QueryExecutionException
public int count(Expression exp) throws QueryExecutionException
public int count(List allobjs, Expression exp) throws QueryExecutionException
public List toList(List allobjs, Expression exp, String saveValueName) throws QueryExecutionException
public List unique(Expression exp) throws QueryExecutionException
public List unique(List objs, Expression exp) throws QueryExecutionException
public List collect(List objs, Expression exp, String saveValueName) throws QueryExecutionException
public List collect(Expression exp) throws QueryExecutionException
public List collect(List allobjs, Expression exp) throws QueryExecutionException
public List toList(Expression exp) throws QueryExecutionException
public List toList(List allobjs, Expression exp) throws QueryExecutionException
public List foreach(Expression exp) throws QueryExecutionException
public List foreach(List allobjs, Expression exp) throws QueryExecutionException
public List foreach(List objs, String exp) throws QueryExecutionException
public List foreach(Expression listFunction, Expression exp) throws QueryExecutionException
public List find(List objs, Expression exp) throws QueryExecutionException
public Map grp(List objs, Expression exp) throws QueryExecutionException
Expression.getValue(Object,Query)
and the return value used as the key to the Map. All objects with that value are
added to a List held against the key. To maintain the ordering of the keys (if
desirable) a LinkedHashMap is used as the return Map.
Note: in accordance with the general operating methodology for the Query
object, the ":_allobjs" special bind variable will be set to the
the List passed in and the "_currobj" will be set to the relevant
object in the List.objs - The List of objects to search.exp - The expression to evaulate against each object in the List.QueryExecutionException - If the expression cannot be evaulated against each
object.public Map map(List objs, Expression exp) throws QueryExecutionException
Expression.getValue(Object,Query)
and the return value used as the value to the Map. To maintain the ordering of the keys (if
desirable) a LinkedHashMap is used as the return Map.
Note: in accordance with the general operating methodology for the Query
object, the ":_allobjs" special bind variable will be set to the
the List passed in and the "_currobj" will be set to the relevant
object in the List.objs - The List of objects to map.exp - The expression to evaulate against each object in the List.QueryExecutionException - If the expression cannot be evaulated against each
object.public Map map(List objs, Expression keyExp, Expression valExp) throws QueryExecutionException
Copyright © 2021. All rights reserved.