Interface TransformationService
-
- All Known Implementing Classes:
ConcreteTransformationService
public interface TransformationService
A service that supports transformation of model values during view generation and transformation of view values during view application.- Author:
- Carl Harris
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description Map.Entry<String,?>
pairToExtract(Object owner, Map.Entry<?,?> pair, ViewNode node, ScopedViewContext context)
Derives a key-value pair to extract for a mapped model property.Map.Entry<?,?>
pairToInject(ViewEntity ownerEntity, Class<?> keyType, Class<?> valueType, String viewKey, Object viewValue, ViewNode node, ScopedViewContext context)
Derives a key-value pair to inject for a model property.Object
valueToExtract(Object owner, Object modelValue, ViewNode node, ScopedViewContext context)
Derives the value to extract for a model property.Object
valueToInject(ViewEntity ownerEntity, Class<?> type, Object viewValue, ViewNode node, ScopedViewContext context)
Derives the value to inject for a model property.
-
-
-
Method Detail
-
valueToExtract
Object valueToExtract(Object owner, Object modelValue, ViewNode node, ScopedViewContext context) throws Exception
Derives the value to extract for a model property.Property listeners on the view context are first allowed to transform the value as desired. Then a value type converter (if available) is used to convert the transformed model value to its view representation.
- Parameters:
owner
- owner of the property in the modelmodelValue
- value of the property in model representationnode
- associated view nodecontext
- view context- Returns:
- derived view property value
- Throws:
Exception
-
valueToInject
Object valueToInject(ViewEntity ownerEntity, Class<?> type, Object viewValue, ViewNode node, ScopedViewContext context) throws Exception
Derives the value to inject for a model property.The view value is first converted to an instance of the model data type. Then property listeners on the view context are allowed to transform the value as desired to arrive at the resulting derived value.
- Parameters:
ownerEntity
- view entity representing the owner of the propertytype
- property type in the modelviewValue
- value of the property in view representationnode
- associated view nodecontext
- view context- Returns:
- derived model property value
- Throws:
Exception
-
pairToExtract
Map.Entry<String,?> pairToExtract(Object owner, Map.Entry<?,?> pair, ViewNode node, ScopedViewContext context) throws Exception
Derives a key-value pair to extract for a mapped model property.Property listeners on the view context are first allowed to transform the key-value pair as desired. Then type converters (if available) are used to convert the transformed key-value pair to its view representation.
- Parameters:
owner
- owner of the property in the modelpair
- key-value pair in model representationnode
- associated view nodecontext
- view context- Returns:
- derived key-pair value
- Throws:
Exception
-
pairToInject
Map.Entry<?,?> pairToInject(ViewEntity ownerEntity, Class<?> keyType, Class<?> valueType, String viewKey, Object viewValue, ViewNode node, ScopedViewContext context) throws Exception
Derives a key-value pair to inject for a model property.The key-value pair from the view is first converted to a data types from the model representation. Then property listeners on the view context are allowed to transform the key-value pair as desired to arrive at the resulting pair.
- Parameters:
ownerEntity
- view entity representing the owner of the propertykeyType
- key type in the modelvalueType
- value type in the modelviewKey
- key of the value in the view representationviewValue
- value of the property in view representationnode
- associated view nodecontext
- view context- Returns:
- derived model property value
- Throws:
Exception
-
-