Spring Data Commons

org.springframework.data.mapping.model
Class PersistentEntityParameterValueProvider<P extends PersistentProperty<P>>

java.lang.Object
  extended by org.springframework.data.mapping.model.PersistentEntityParameterValueProvider<P>
All Implemented Interfaces:
ParameterValueProvider<P>

public class PersistentEntityParameterValueProvider<P extends PersistentProperty<P>>
extends Object
implements ParameterValueProvider<P>

ParameterValueProvider based on a PersistentEntity to use a PropertyValueProvider to lookup the value of the property referenced by the given PreferredConstructor.Parameter. Additionally a DefaultSpELExpressionEvaluator can be configured to get property value resolution trumped by a SpEL expression evaluation.

Author:
Oliver Gierke

Constructor Summary
PersistentEntityParameterValueProvider(PersistentEntity<?,P> entity, PropertyValueProvider<P> provider, Object parent)
          Creates a new PersistentEntityParameterValueProvider for the given PersistentEntity and PropertyValueProvider.
 
Method Summary
<T> T
getParameterValue(PreferredConstructor.Parameter<T,P> parameter)
          Returns the value to be used for the given PreferredConstructor.Parameter (usually when entity instances are created).
 void setSpELEvaluator(SpELExpressionEvaluator spELEvaluator)
          Configures a DefaultSpELExpressionEvaluator to evaluate the SpEL Expression the PreferredConstructor.Parameter potentially carries.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PersistentEntityParameterValueProvider

public PersistentEntityParameterValueProvider(PersistentEntity<?,P> entity,
                                              PropertyValueProvider<P> provider,
                                              Object parent)
Creates a new PersistentEntityParameterValueProvider for the given PersistentEntity and PropertyValueProvider.

Parameters:
entity - must not be null.
provider - must not be null.
parent - the parent object being created currently, can be null.
Method Detail

setSpELEvaluator

public void setSpELEvaluator(SpELExpressionEvaluator spELEvaluator)
Configures a DefaultSpELExpressionEvaluator to evaluate the SpEL Expression the PreferredConstructor.Parameter potentially carries.

Parameters:
spELEvaluator -

getParameterValue

public <T> T getParameterValue(PreferredConstructor.Parameter<T,P> parameter)
Description copied from interface: ParameterValueProvider
Returns the value to be used for the given PreferredConstructor.Parameter (usually when entity instances are created).

Specified by:
getParameterValue in interface ParameterValueProvider<P extends PersistentProperty<P>>
Parameters:
parameter - must not be null.
Returns:

Spring Data Commons

Copyright © 2012. All Rights Reserved.