public interface HttpParametersLoader<T>
Loader that loads the HttpRequest
parameters onto an Object -
following bean pattern of void setXxx(String value)
methods.
Due to the complications of attempting to validate and translate values, the
HttpParametersLoader
will only load String
values. Validation
of the values can then be done on the values contained in the loaded Object.
Modifier and Type | Method and Description |
---|---|
void |
init(Class<T> type,
Map<String,String> aliasMappings,
boolean isCaseSensitive,
ObjectInstantiator objectInstantiator)
Initialises this
HttpParametersLoader . |
<O extends T> |
loadParameters(HttpRequest httpRequest,
O object)
Loads the parameters of the
HttpRequest to the Object. |
void init(Class<T> type, Map<String,String> aliasMappings, boolean isCaseSensitive, ObjectInstantiator objectInstantiator) throws Exception
HttpParametersLoader
.type
- Type of object to be loaded (and may be an interface). The
type is interrogated for
public void setXxx(String value)
methods for
loading corresponding parameters. The property name of each
method is the method name stripped of the leading
set
.aliasMappings
- Alias mappings so HttpRequest
parameter names need not
match exactly the Object method property names.isCaseSensitive
- Flag indicating if matching on parameter names is to be case
sensitive. Specifying false
results in matching
names ignoring case - which makes for more tolerable loading.objectInstantiator
- ObjectInstantiator
.Exception
- If fails to initialise.<O extends T> void loadParameters(HttpRequest httpRequest, O object) throws IOException, HttpParametersException
HttpRequest
to the Object.O
- Object type.httpRequest
- HttpRequest
to extract the parameters.object
- Object to be loaded with the parameters.IOException
- If fails to read data from the HttpRequest
.HttpParametersException
- If fails to load the HttpRequest
parameters to the
Object.Copyright © 2005–2016. All rights reserved.