Class Query
java.lang.Object
org.dspace.importer.external.datamodel.Query
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 -
Method Summary
Modifier and TypeMethodDescriptionvoidaddParameter(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.getParameter(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.MultiValuedMapRetrieve the parameters set to this Query objectvoidsetParameters(org.apache.commons.collections4.MultiValuedMap parameters) Set the parameters of this query object based on a givenMultiValuedMap
-
Constructor Details
-
Query
public Query()
-
-
Method Details
-
getParameters
public org.apache.commons.collections4.MultiValuedMap getParameters()Retrieve the parameters set to this Query object- Returns:
- the
MultiValuedMapset to this object
-
addParameter
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
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
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
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
-