net.craftforge.essential.controller.managers
Class ParameterHandler
java.lang.Object
net.craftforge.essential.controller.managers.ParameterHandler
public class ParameterHandler
- extends Object
- Since:
- 21.08.11
- Author:
- Christian Bick
|
Method Summary |
protected Object |
convertToObject(Consumer consumer,
Class<?> type,
String parameterValue)
|
protected ControllerException |
getMissingParameterException(String paramName)
|
String |
getParameterValue(String parameterName,
String[] defaultValues)
|
Object |
getParameterValueAsObject(Consumer consumer,
Class<?> type,
String parameterName,
String[] defaultValues)
|
String[] |
getParameterValues(String parameterName,
String[] defaultValues)
|
|
getParameterValuesAsObject(Consumer consumer,
Class<?> collectionType,
Class<G> typeArgument,
String parameterName,
String[] defaultValues)
Gets the input for a collection type using the generic type as deserialization hint
for the parameter values associated to the given parameter name. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
ParameterHandler
public ParameterHandler(Map<String,String[]> parameters)
getParameterValues
public String[] getParameterValues(String parameterName,
String[] defaultValues)
throws ControllerException
- Throws:
ControllerException
getParameterValue
public String getParameterValue(String parameterName,
String[] defaultValues)
throws ControllerException
- Throws:
ControllerException
getParameterValueAsObject
public Object getParameterValueAsObject(Consumer consumer,
Class<?> type,
String parameterName,
String[] defaultValues)
throws ControllerException
- Throws:
ControllerException
getParameterValuesAsObject
public <G> Collection<G> getParameterValuesAsObject(Consumer consumer,
Class<?> collectionType,
Class<G> typeArgument,
String parameterName,
String[] defaultValues)
throws ControllerException
- Gets the input for a collection type using the generic type as deserialization hint
for the parameter values associated to the given parameter name.
- Type Parameters:
G - The generic type parameter- Parameters:
consumer - The consumercollectionType - The collection typetypeArgument - The collection's generic type argumentparameterName - The parameter namedefaultValues - The default values to use if no parameter values are given
- Returns:
- The collection initialized from the parameter values
- Throws:
ControllerException - Failed to initialize the collection
convertToObject
protected Object convertToObject(Consumer consumer,
Class<?> type,
String parameterValue)
throws ControllerException
- Throws:
ControllerException
getMissingParameterException
protected ControllerException getMissingParameterException(String paramName)
Copyright © 2011. All Rights Reserved.