Package net.officefloor.web.value.load
Class ValueLoaderSource
- java.lang.Object
-
- net.officefloor.web.value.load.ValueLoaderSource
-
public class ValueLoaderSource extends java.lang.ObjectSources theValueLoaderFactoryfor aClasstype.- Author:
- Daniel Sagenschneider
-
-
Constructor Summary
Constructors Constructor Description ValueLoaderSource(java.lang.Class<?> type, boolean isCaseInsensitive, java.util.Map<java.lang.String,java.lang.String> aliasMappings, ObjectInstantiator objectInstantiator)Initialise.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static StatelessValueLoaderFactory[]createValueLoaderFactories(java.lang.Class<?> type, PropertyKeyFactory propertyKeyFactory, ObjectInstantiator objectInstantiator, java.util.Map<java.lang.String,java.lang.String> aliasMappings, java.util.Map<java.lang.Class<?>,StatelessValueLoaderFactory[]> factoriesByType)CreatesStatelessValueLoaderFactoryinstances for the type.static HttpValueLocationgetLocation(java.lang.reflect.Method method)Obtains theHttpValueLocationfor theMethod.static booleanisLocationMatch(HttpValueLocation loaderLocation, HttpValueLocation valueLocation)Indicates if matchHttpValueLocation.static voidloadValue(java.lang.Object object, java.lang.reflect.Method method, java.lang.Object... parameters)Loads the value onto the object.<T> ValueLoaderFactory<T>sourceValueLoaderFactory(java.lang.Class<T> clazz)Sources theValueLoaderFactory.
-
-
-
Constructor Detail
-
ValueLoaderSource
public ValueLoaderSource(java.lang.Class<?> type, boolean isCaseInsensitive, java.util.Map<java.lang.String,java.lang.String> aliasMappings, ObjectInstantiator objectInstantiator) throws java.lang.ExceptionInitialise.- Parameters:
type- Type to interrogate for properties to be loaded.isCaseInsensitive- Flag indicating if case sensitive matching.aliasMappings- Alias Mappings.objectInstantiator-ObjectInstantiator.- Throws:
java.lang.Exception- If fails to initialise.
-
-
Method Detail
-
loadValue
public static void loadValue(java.lang.Object object, java.lang.reflect.Method method, java.lang.Object... parameters) throws HttpExceptionLoads 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
public static HttpValueLocation getLocation(java.lang.reflect.Method method)
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(java.lang.Class<?> type, PropertyKeyFactory propertyKeyFactory, ObjectInstantiator objectInstantiator, java.util.Map<java.lang.String,java.lang.String> aliasMappings, java.util.Map<java.lang.Class<?>,StatelessValueLoaderFactory[]> factoriesByType) throws java.lang.Exception
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:
java.lang.Exception- If fails to create theStatelessValueLoaderFactoryinstances.
-
sourceValueLoaderFactory
public <T> ValueLoaderFactory<T> sourceValueLoaderFactory(java.lang.Class<T> clazz) throws java.lang.Exception
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:
java.lang.Exception- If fails to source theValueLoaderFactory.
-
-