public class SpelAttributeValueMutator extends Object implements AttributeValueMutator
| Modifier and Type | Field and Description | 
|---|---|
private Attribute | 
attribute
Attribute containing the SPEL expression. 
 | 
private org.springframework.expression.EvaluationContext | 
evaluationContext
Evaluation context. 
 | 
private org.springframework.expression.Expression | 
expression
SPEL expression to access values. 
 | 
protected Logger | 
logger
Logger for this class. 
 | 
private ValueTranscoder | 
transcoder
Custom transcoder for this attribute. 
 | 
| Constructor and Description | 
|---|
SpelAttributeValueMutator(Attribute attr,
                         org.springframework.expression.EvaluationContext context)
Creates a new spel attribute value mutator. 
 | 
| Modifier and Type | Method and Description | 
|---|---|
protected <T> T | 
convertValue(Object value,
            Class<?> sourceType,
            Class<T> targetType)
Converts the supplied value to the target type. 
 | 
protected static <T> Collection<T> | 
createCollection(Class<?> type,
                int size)
Creates a best fit collection for the supplied type. 
 | 
Collection<byte[]> | 
getBinaryValues(Object object)
Returns the binary values of the attribute. 
 | 
String | 
getName()
Returns the name of the attribute. 
 | 
SortBehavior | 
getSortBehavior()
Returns the sort behavior of the attribute. 
 | 
Collection<String> | 
getStringValues(Object object)
Returns the string values of the attribute. 
 | 
protected <T> Collection<T> | 
getValues(Object object,
         Class<T> type)
Uses the configured expression and evaluation context to retrieve values from the supplied object. 
 | 
boolean | 
isBinary()
Returns whether the attribute is binary. 
 | 
void | 
setBinaryValues(Object object,
               Collection<byte[]> values)
Sets the binary values of the attribute. 
 | 
void | 
setStringValues(Object object,
               Collection<String> values)
Sets the string values of the attribute. 
 | 
protected <T> void | 
setValues(Object object,
         Collection<T> values,
         Class<T> type)
Uses the configured expression and evaluation context to set values on the supplied object. 
 | 
String | 
toString()  | 
protected final Logger logger
private final Attribute attribute
private final org.springframework.expression.Expression expression
private final org.springframework.expression.EvaluationContext evaluationContext
private final ValueTranscoder transcoder
public SpelAttributeValueMutator(Attribute attr, org.springframework.expression.EvaluationContext context)
attr - containing the SPEL configurationcontext - containing the valuespublic String getName()
AttributeValueMutatorgetName in interface AttributeValueMutatorpublic boolean isBinary()
AttributeValueMutatorisBinary in interface AttributeValueMutatorpublic SortBehavior getSortBehavior()
AttributeValueMutatorgetSortBehavior in interface AttributeValueMutatorpublic Collection<String> getStringValues(Object object)
AttributeValueMutatorgetStringValues in interface AttributeValueMutatorobject - containing attribute valuespublic Collection<byte[]> getBinaryValues(Object object)
AttributeValueMutatorgetBinaryValues in interface AttributeValueMutatorobject - containing attribute valuesprotected <T> Collection<T> getValues(Object object, Class<T> type)
T - either String or byte[]object - to get values fromtype - of objects to place in the collectionprotected <T> T convertValue(Object value, Class<?> sourceType, Class<T> targetType)
T - either String or byte[]value - to convertsourceType - to convert fromtargetType - to convert topublic void setStringValues(Object object, Collection<String> values)
AttributeValueMutatorsetStringValues in interface AttributeValueMutatorobject - to set values onvalues - to setpublic void setBinaryValues(Object object, Collection<byte[]> values)
AttributeValueMutatorsetBinaryValues in interface AttributeValueMutatorobject - to set values onvalues - to setprotected <T> void setValues(Object object, Collection<T> values, Class<T> type)
T - either String or byte[]object - to set values onvalues - to settype - of objects in the collectionprotected static <T> Collection<T> createCollection(Class<?> type, int size)
T - collection typetype - of collection to createsize - of the collectionCopyright © 2003-2019 Virginia Tech. All Rights Reserved.