|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.jage.query.MultiElementQuery<E,Collection<E>,Collection<T>>
org.jage.query.CollectionQuery<E,T>
E
- A type of elements in the queried collection.T
- A type of elements in the result.public class CollectionQuery<E,T>
Query implementation that can be used with subclasses of the Collection
class. The queried object must be an
instance of the Collection class and the provided results also are of this type.
Field Summary |
---|
Fields inherited from class org.jage.query.MultiElementQuery |
---|
elementClass, functions, initialSelectors, resultClass, targetClass, valueFilter, valueSelectors |
Constructor Summary | |
---|---|
CollectionQuery(Class<?> elementClass)
Constructs a new CollectionQuery instance. |
|
CollectionQuery(Class<?> elementClass,
Class<?> targetClass,
Class<?> resultClass)
Constructs a new CollectionQuery instance. |
Method Summary | ||
---|---|---|
protected Collection<T> |
convertToResult(List<?> newSelected)
Converts a provided list of selected elements (raw results of the query) to the object of the type required (and specified) by the user. |
|
CollectionQuery<E,T> |
from(IInitialSelector selector)
Adds a selector to the query. |
|
CollectionQuery<E,T> |
matching(IValueFilter<E> filter)
Adds a value filter to the query. |
|
|
matching(String fieldName,
IValueFilter<S> filter)
Adds a value filter that operates on a specific field of the element class to the query. |
|
CollectionQuery<E,T> |
process(IQueryFunction<Collection<T>> queryFunction)
Adds a function that will process results. |
|
|
select(IValueSelector<E,S> valueSelector)
Adds a selector to the query. |
|
CollectionQuery<E,T> |
select(String... fields)
Adds a selector to the query. |
Methods inherited from class org.jage.query.MultiElementQuery |
---|
addInitialSelector, addQueryFunction, addValueFilter, addValueSelector, execute, getListFromTarget |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public CollectionQuery(Class<?> elementClass, Class<?> targetClass, Class<?> resultClass)
The execution of an empty query will result in the same object being returned. No operation will be performed.
elementClass
- A class of the components in the queried composition.targetClass
- A class of the queried object.resultClass
- A class of the result, it must be a class that can be instantiated. If it is not, a
QueryException
will be thrown during query execution.public CollectionQuery(Class<?> elementClass)
elementClass
- A class of the components in the queried composition.Method Detail |
---|
protected Collection<T> convertToResult(List<?> newSelected)
MultiElementQuery
This implementation requires a result class (MultiElementQuery.resultClass
) to implement a Collection
interface.
convertToResult
in class MultiElementQuery<E,Collection<E>,Collection<T>>
newSelected
- Raw results to convert.
public CollectionQuery<E,T> from(IInitialSelector selector)
from
in class MultiElementQuery<E,Collection<E>,Collection<T>>
selector
- A selector to add.
public <S> CollectionQuery<E,T> select(IValueSelector<E,S> valueSelector)
select
in class MultiElementQuery<E,Collection<E>,Collection<T>>
S
- A type of the selected value.valueSelector
- A selector to add.
public CollectionQuery<E,T> select(String... fields)
select
in class MultiElementQuery<E,Collection<E>,Collection<T>>
fields
- A fields to select. Fields needs to be accessible by getters in the JavaBean naming convention.
public CollectionQuery<E,T> matching(IValueFilter<E> filter)
matching
in class MultiElementQuery<E,Collection<E>,Collection<T>>
filter
- A value filter to add.
public <S> CollectionQuery<E,T> matching(String fieldName, IValueFilter<S> filter)
matching
in class MultiElementQuery<E,Collection<E>,Collection<T>>
S
- A type of the field.fieldName
- A field name that will be used in matching.filter
- A value filter to add.
public CollectionQuery<E,T> process(IQueryFunction<Collection<T>> queryFunction)
process
in class MultiElementQuery<E,Collection<E>,Collection<T>>
queryFunction
- A function to execute on results.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |