org.springframework.data.projection

## Class SpelAwareProxyProjectionFactory

- java.lang.Object
- - org.springframework.data.projection.SpelAwareProxyProjectionFactory

All Implemented Interfaces:
  Aware, BeanClassLoaderAware, BeanFactoryAware, ProjectionFactory

    public class SpelAwareProxyProjectionFactory
    extends Object
    implements BeanFactoryAware

A `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.

Since:
  1.10
Author:
  Oliver Gierke, Thomas Darimont, Mark Paluch, Jens Schauder

### Nested Class Summary

Nested Classes
`protected static class` `SpelAwareProxyProjectionFactory.SpelAwareProjectionInformation`

### Constructor Summary

Constructors
Constructor and Description
`SpelAwareProxyProjectionFactory()`

### Method Summary

All Methods Instance Methods Concrete Methods
`<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)`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Methods inherited from interface org.springframework.data.projection.ProjectionFactory

`createNullableProjection`

### Constructor Detail

#### SpelAwareProxyProjectionFactory

    public SpelAwareProxyProjectionFactory()

### Method Detail

#### setBeanFactory

    public void setBeanFactory(BeanFactory beanFactory)
                        throws BeansException

Specified by:
  `setBeanFactory` in interface `BeanFactoryAware`
Throws:
  `BeansException`

#### createProjectionInformation

    protected ProjectionInformation createProjectionInformation(Class<?> projectionType)

Creates a fresh, cacheable `ProjectionInformation` instance for the given projection type.

Parameters:
  `projectionType` - must not be null.
Returns:

#### postProcessAccessorInterceptor

    protected MethodInterceptor postProcessAccessorInterceptor(MethodInterceptor interceptor,
                                                               Object source,
                                                               Class<?> projectionType)

Inspects the given target type for methods with `Value` annotations and caches the result. Will create a `SpelEvaluatingMethodInterceptor` if an annotation was found or return the delegate as is if not.

Parameters:
  `interceptor` - the root `MethodInterceptor`.
  `source` - The backing source object.
  `projectionType` - the proxy target type.
Returns:

#### setBeanClassLoader

    public void setBeanClassLoader(ClassLoader classLoader)

Specified by:
  `setBeanClassLoader` in interface `BeanClassLoaderAware`

#### registerMethodInvokerFactory

    public void registerMethodInvokerFactory(MethodInterceptorFactory factory)

Registers the given `MethodInterceptorFactory` to be used with the factory. Factories registered later enjoy precedence over previously registered ones.

Parameters:
  `factory` - must not be null.
Since:
  1.13

#### createProjection

    public <T> T createProjection(Class<T> projectionType,
                                  Object source)

Description copied from interface: `ProjectionFactory`
Creates a projection of the given type for the given source object. The individual mapping strategy is defined by the implementations.

Specified by:
  `createProjection` in interface `ProjectionFactory`
Parameters:
  `projectionType` - the type to create, must not be null.
  `source` - the object to create a projection for, must not be null.
Returns:

#### createProjection

    public <T> T createProjection(Class<T> projectionType)

Description copied from interface: `ProjectionFactory`
Creates a projection instance for the given type.

Specified by:
  `createProjection` in interface `ProjectionFactory`
Parameters:
  `projectionType` - the type to create, must not be null.
Returns:

#### getProjectionInformation

    public final ProjectionInformation getProjectionInformation(Class<?> projectionType)

Description copied from interface: `ProjectionFactory`
Returns the `ProjectionInformation` for the given projection type.

Specified by:
  `getProjectionInformation` in interface `ProjectionFactory`
Parameters:
  `projectionType` - must not be null.
Returns: