public class SpelAwareProxyProjectionFactory extends Object implements BeanFactoryAware
ProxyProjectionFactory
that adds support to use Value
-annotated methods on a projection interface
to evaluate the contained SpEL expression to define the outcome of the method call.Modifier and Type | Class and Description |
---|---|
protected static class |
SpelAwareProxyProjectionFactory.SpelAwareProjectionInformation |
Constructor and Description |
---|
SpelAwareProxyProjectionFactory() |
Modifier and Type | Method and Description |
---|---|
<T> T |
createProjection(Class<T> projectionType)
Creates a projection instance for the given type.
|
<T> T |
createProjection(Class<T> projectionType,
Object source)
Creates a projection of the given type for the given source object.
|
protected ProjectionInformation |
createProjectionInformation(Class<?> projectionType)
Creates a fresh, cacheable
ProjectionInformation instance for the given projection type. |
ProjectionInformation |
getProjectionInformation(Class<?> projectionType)
Returns the
ProjectionInformation for the given projection type. |
protected MethodInterceptor |
postProcessAccessorInterceptor(MethodInterceptor interceptor,
Object source,
Class<?> projectionType)
Inspects the given target type for methods with
Value annotations and caches the result. |
void |
registerMethodInvokerFactory(MethodInterceptorFactory factory)
Registers the given
MethodInterceptorFactory to be used with the factory. |
void |
setBeanClassLoader(ClassLoader classLoader) |
void |
setBeanFactory(BeanFactory beanFactory) |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
createNullableProjection
public void setBeanFactory(BeanFactory beanFactory) throws BeansException
setBeanFactory
in interface BeanFactoryAware
BeansException
protected ProjectionInformation createProjectionInformation(Class<?> projectionType)
ProjectionInformation
instance for the given projection type.projectionType
- must not be null.protected MethodInterceptor postProcessAccessorInterceptor(MethodInterceptor interceptor, Object source, Class<?> projectionType)
Value
annotations and caches the result. Will create a
SpelEvaluatingMethodInterceptor
if an annotation was found or return the delegate as is if not.interceptor
- the root MethodInterceptor
.source
- The backing source object.projectionType
- the proxy target type.public void setBeanClassLoader(ClassLoader classLoader)
setBeanClassLoader
in interface BeanClassLoaderAware
public void registerMethodInvokerFactory(MethodInterceptorFactory factory)
MethodInterceptorFactory
to be used with the factory. Factories registered later enjoy
precedence over previously registered ones.factory
- must not be null.public <T> T createProjection(Class<T> projectionType, Object source)
ProjectionFactory
createProjection
in interface ProjectionFactory
projectionType
- the type to create, must not be null.source
- the object to create a projection for, must not be null.public <T> T createProjection(Class<T> projectionType)
ProjectionFactory
createProjection
in interface ProjectionFactory
projectionType
- the type to create, must not be null.public final ProjectionInformation getProjectionInformation(Class<?> projectionType)
ProjectionFactory
ProjectionInformation
for the given projection type.getProjectionInformation
in interface ProjectionFactory
projectionType
- must not be null.Copyright © 2011–2018 Pivotal Software, Inc.. All rights reserved.