Package net.officefloor.web.value.load
Class ValueLoaderSource
- java.lang.Object
-
- net.officefloor.web.value.load.ValueLoaderSource
-
public class ValueLoaderSource extends java.lang.Object
Sources theValueLoaderFactory
for aClass
type.- 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)
CreatesStatelessValueLoaderFactory
instances for the type.static HttpValueLocation
getLocation(java.lang.reflect.Method method)
Obtains theHttpValueLocation
for theMethod
.static boolean
isLocationMatch(HttpValueLocation loaderLocation, HttpValueLocation valueLocation)
Indicates if matchHttpValueLocation
.static void
loadValue(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.Exception
Initialise.- 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 HttpException
Loads the value onto the object.- Parameters:
object
-Object
to have value loaded on it.method
-Method
to 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 theHttpValueLocation
for theMethod
.- Parameters:
method
-Method
.- Returns:
HttpValueLocation
ornull
if match allHttpValueLocation
.
-
isLocationMatch
public static boolean isLocationMatch(HttpValueLocation loaderLocation, HttpValueLocation valueLocation)
Indicates if matchHttpValueLocation
.- Parameters:
loaderLocation
-StatelessValueLoader
HttpValueLocation
. May benull
to match anyHttpValueLocation
.valueLocation
-HttpValueLocation
for the value.- Returns:
true
if 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
CreatesStatelessValueLoaderFactory
instances for the type.- Parameters:
type
- Type to createStatelessValueLoaderFactory
instances.propertyKeyFactory
-PropertyKeyFactory
.objectInstantiator
-ObjectInstantiator
.aliasMappings
- Alias mappings.factoriesByType
-StatelessValueLoaderFactory
instances by type.- Returns:
StatelessValueLoaderFactory
instances for the type.- Throws:
java.lang.Exception
- If fails to create theStatelessValueLoaderFactory
instances.
-
sourceValueLoaderFactory
public <T> ValueLoaderFactory<T> sourceValueLoaderFactory(java.lang.Class<T> clazz) throws java.lang.Exception
Sources the
ValueLoaderFactory
.The returned
ValueLoaderFactory
is specific to the inputClass
. TheValueLoaderFactory
will not work with children of theClass
. A newValueLoaderFactory
must be created for each child type.- Type Parameters:
T
-Class
type.- Parameters:
clazz
-Class
for a dedicatedValueLoaderFactory
. It is expected that all property methods on thetype
are on thisclazz
.- Returns:
ValueLoaderFactory
.- Throws:
java.lang.Exception
- If fails to source theValueLoaderFactory
.
-
-