Class Query
- java.lang.Object
-
- org.dspace.importer.external.datamodel.Query
-
public class Query extends Object
Represents a query to a source. Subclasses may enforce stricter typing or more verbose setting of parameters.- Author:
- Roeland Dillen (roeland at atmire dot com)
-
-
Constructor Summary
Constructors Constructor Description Query()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddParameter(String key, Object value)In the parameters variable, adds the value to the collection associated with the specified key.protected voidaddSingletonParameter(String key, Object value)In the parameters variable, adds the value to the collection associated with the specified key.CollectiongetParameter(String key)Gets the collection mapped to the specified key.<T> TgetParameterAsClass(String key, Class<T> clazz)Retrieve a parameter as a certain given classorg.apache.commons.collections4.MultiValuedMapgetParameters()Retrieve the parameters set to this Query objectvoidsetParameters(org.apache.commons.collections4.MultiValuedMap parameters)Set the parameters of this query object based on a givenMultiValuedMap
-
-
-
Method Detail
-
getParameters
public org.apache.commons.collections4.MultiValuedMap getParameters()
Retrieve the parameters set to this Query object- Returns:
- the
MultiValuedMapset to this object
-
addParameter
public void addParameter(String key, Object value)
In the parameters variable, adds the value to the collection associated with the specified key.Unlike a normal
Mapthe previous value is not replaced. Instead the new value is added to the collection stored against the key.- Parameters:
key- the key to store againstvalue- the value to add to the collection at the key
-
addSingletonParameter
protected void addSingletonParameter(String key, Object value)
In the parameters variable, adds the value to the collection associated with the specified key.Unlike
addParameter(String, Object)the previous value is overridden. First, any existing values are removed, then the new value is added to the collection at the specified key- Parameters:
key- the key to store againstvalue- the value to add to the collection at the key
-
getParameterAsClass
public <T> T getParameterAsClass(String key, Class<T> clazz)
Retrieve a parameter as a certain given class- Type Parameters:
T- the type of parameter returned.- Parameters:
key- the key to retrieve the parameter fromclazz- the type to retrieve. (If no parameter with that class is found, a null value is returned.)- Returns:
- the selected parameter, or null.
-
getParameter
public Collection getParameter(String key)
Gets the collection mapped to the specified key. This method is a convenience method to typecast the result ofget(key).- Parameters:
key- the key used to retrieve the collection- Returns:
- the collection mapped to the key, null if no mapping
-
setParameters
public void setParameters(org.apache.commons.collections4.MultiValuedMap parameters)
Set the parameters of this query object based on a givenMultiValuedMap- Parameters:
parameters- aorg.apache.commons.collections.map.MultiValuedMapto set to this Query object
-
-