org.jage.query
Class PropertyContainerCollectionQuery<E extends IPropertyContainer,T>

java.lang.Object
  extended by org.jage.query.MultiElementQuery<E,Collection<E>,Collection<T>>
      extended by org.jage.query.CollectionQuery<E,T>
          extended by org.jage.query.PropertyContainerCollectionQuery<E,T>
Type Parameters:
E - A type of elements in the collection. T must be a realisation of IPropertyContainer.
T - A type of elements in the result.
All Implemented Interfaces:
IQuery<Collection<E>,Collection<T>>
Direct Known Subclasses:
AgentEnvironmentQuery

public class PropertyContainerCollectionQuery<E extends IPropertyContainer,T>
extends CollectionQuery<E,T>

Query implementation that can be used with subclasses of the Collection class.

Author:
AGH AgE Team

Field Summary
 
Fields inherited from class org.jage.query.MultiElementQuery
elementClass, functions, initialSelectors, resultClass, targetClass, valueFilter, valueSelectors
 
Constructor Summary
PropertyContainerCollectionQuery()
          Constructs a new PropertyContainerCollectionQuery instance.
PropertyContainerCollectionQuery(Class<?> elementClass)
          Constructs a new PropertyContainerCollectionQuery instance.
PropertyContainerCollectionQuery(Class<?> elementClass, Class<?> targetClass, Class<?> resultClass)
          Constructs a new PropertyContainerCollectionQuery instance.
 
Method Summary
<S> PropertyContainerCollectionQuery<E,T>
matching(String propertyName, IValueFilter<S> filter)
          Adds a value filter to the query.
 
Methods inherited from class org.jage.query.CollectionQuery
convertToResult, from, matching, process, select, select
 
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

PropertyContainerCollectionQuery

public PropertyContainerCollectionQuery(Class<?> elementClass,
                                        Class<?> targetClass,
                                        Class<?> resultClass)
Constructs a new PropertyContainerCollectionQuery instance. PropertyContainerCollectionQuery requires the target, the result and the element class being provided. It will use them for creating the result object.

The execution of an empty query will result in the same object being returned. No operation will be performed.

Parameters:
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.

PropertyContainerCollectionQuery

public PropertyContainerCollectionQuery(Class<?> elementClass)
Constructs a new PropertyContainerCollectionQuery instance. This constructor requires only the element class being provided. Collection is used as the target class and ArrayList as the result class.

Parameters:
elementClass - A class of the components in the queried composition.

PropertyContainerCollectionQuery

public PropertyContainerCollectionQuery()
Constructs a new PropertyContainerCollectionQuery instance. This constructor uses following default values: IPropertyContainer is used as the element class, Collection as the target class and ArrayList as the result class.

Method Detail

matching

public <S> PropertyContainerCollectionQuery<E,T> matching(String propertyName,
                                                          IValueFilter<S> filter)
Adds a value filter to the query. This value filter operates on the property with the given name.

Overrides:
matching in class CollectionQuery<E extends IPropertyContainer,T>
Type Parameters:
S - A type of a value of the tested property.
Parameters:
propertyName - A name of the property that will be used in filtering.
filter - A value filter to add.
Returns:
This query.


Copyright © 2006-2011 AGH University of Science and Technology. All Rights Reserved.