Package net.officefloor.web.value.load
Class ValueLoaderSource
java.lang.Object
net.officefloor.web.value.load.ValueLoaderSource
Sources the
ValueLoaderFactory for a Class type.- Author:
- Daniel Sagenschneider
-
Constructor Summary
ConstructorsConstructorDescriptionValueLoaderSource(Class<?> type, boolean isCaseInsensitive, Map<String, String> aliasMappings, ObjectInstantiator objectInstantiator) Initialise. -
Method Summary
Modifier and TypeMethodDescriptionstatic StatelessValueLoaderFactory[]createValueLoaderFactories(Class<?> type, PropertyKeyFactory propertyKeyFactory, ObjectInstantiator objectInstantiator, Map<String, String> aliasMappings, Map<Class<?>, StatelessValueLoaderFactory[]> factoriesByType) CreatesStatelessValueLoaderFactoryinstances for the type.static HttpValueLocationgetLocation(Method method) Obtains theHttpValueLocationfor theMethod.static booleanisLocationMatch(HttpValueLocation loaderLocation, HttpValueLocation valueLocation) Indicates if matchHttpValueLocation.static voidLoads the value onto the object.<T> ValueLoaderFactory<T>sourceValueLoaderFactory(Class<T> clazz) Sources theValueLoaderFactory.
-
Constructor Details
-
ValueLoaderSource
public ValueLoaderSource(Class<?> type, boolean isCaseInsensitive, Map<String, String> aliasMappings, ObjectInstantiator objectInstantiator) throws ExceptionInitialise.- Parameters:
type- Type to interrogate for properties to be loaded.isCaseInsensitive- Flag indicating if case sensitive matching.aliasMappings- Alias Mappings.objectInstantiator-ObjectInstantiator.- Throws:
Exception- If fails to initialise.
-
-
Method Details
-
loadValue
public static void loadValue(Object object, Method method, Object... parameters) throws HttpException Loads the value onto the object.- Parameters:
object-Objectto have value loaded on it.method-Methodto load the values.parameters- Values to be loaded into theMethod.- Throws:
HttpException- If fails to load the values.
-
getLocation
Obtains theHttpValueLocationfor theMethod.- Parameters:
method-Method.- Returns:
HttpValueLocationornullif match allHttpValueLocation.
-
isLocationMatch
public static boolean isLocationMatch(HttpValueLocation loaderLocation, HttpValueLocation valueLocation) Indicates if matchHttpValueLocation.- Parameters:
loaderLocation-StatelessValueLoaderHttpValueLocation. May benullto match anyHttpValueLocation.valueLocation-HttpValueLocationfor the value.- Returns:
trueif matchHttpValueLocation.
-
createValueLoaderFactories
public static StatelessValueLoaderFactory[] createValueLoaderFactories(Class<?> type, PropertyKeyFactory propertyKeyFactory, ObjectInstantiator objectInstantiator, Map<String, String> aliasMappings, Map<Class<?>, throws ExceptionStatelessValueLoaderFactory[]> factoriesByType) CreatesStatelessValueLoaderFactoryinstances for the type.- Parameters:
type- Type to createStatelessValueLoaderFactoryinstances.propertyKeyFactory-PropertyKeyFactory.objectInstantiator-ObjectInstantiator.aliasMappings- Alias mappings.factoriesByType-StatelessValueLoaderFactoryinstances by type.- Returns:
StatelessValueLoaderFactoryinstances for the type.- Throws:
Exception- If fails to create theStatelessValueLoaderFactoryinstances.
-
sourceValueLoaderFactory
Sources the
ValueLoaderFactory.The returned
ValueLoaderFactoryis specific to the inputClass. TheValueLoaderFactorywill not work with children of theClass. A newValueLoaderFactorymust be created for each child type.- Type Parameters:
T-Classtype.- Parameters:
clazz-Classfor a dedicatedValueLoaderFactory. It is expected that all property methods on thetypeare on thisclazz.- Returns:
ValueLoaderFactory.- Throws:
Exception- If fails to source theValueLoaderFactory.
-