DATACMNS-1107 - Polishing.

Moved methods around in ProjectionFactory implementations to follow the coding guidelines.
This commit is contained in:
Oliver Gierke
2017-07-11 11:23:37 +02:00
parent 6e09c09afa
commit b724797dc6
2 changed files with 32 additions and 32 deletions

View File

@@ -134,6 +134,20 @@ class ProxyProjectionFactory implements ProjectionFactory, BeanClassLoaderAware
return projectionInformationCache.computeIfAbsent(projectionType, this::createProjectionInformation);
}
/**
* Post-process the given {@link MethodInterceptor} for the given source instance and projection type. Default
* implementation will simply return the given interceptor.
*
* @param interceptor will never be {@literal null}.
* @param source will never be {@literal null}.
* @param projectionType will never be {@literal null}.
* @return
*/
protected MethodInterceptor postProcessAccessorInterceptor(MethodInterceptor interceptor, Object source,
Class<?> projectionType) {
return interceptor;
}
/**
* Creates a fresh, cacheable {@link ProjectionInformation} instance for the given projection type.
*
@@ -178,20 +192,6 @@ class ProxyProjectionFactory implements ProjectionFactory, BeanClassLoaderAware
throw new IllegalStateException("No MethodInterceptorFactory found for type ".concat(source.getClass().getName()));
}
/**
* Post-process the given {@link MethodInterceptor} for the given source instance and projection type. Default
* implementation will simply return the given interceptor.
*
* @param interceptor will never be {@literal null}.
* @param source will never be {@literal null}.
* @param projectionType will never be {@literal null}.
* @return
*/
protected MethodInterceptor postProcessAccessorInterceptor(MethodInterceptor interceptor, Object source,
Class<?> projectionType) {
return interceptor;
}
/**
* Custom {@link MethodInterceptor} to expose the proxy target class even if we set
* {@link ProxyFactory#setOpaque(boolean)} to true to prevent properties on {@link Advised} to be rendered.

View File

@@ -56,24 +56,6 @@ public class SpelAwareProxyProjectionFactory extends ProxyProjectionFactory impl
this.beanFactory = beanFactory;
}
/**
* Inspects the given target type for methods with {@link Value} annotations and caches the result. Will create a
* {@link SpelEvaluatingMethodInterceptor} if an annotation was found or return the delegate as is if not.
*
* @param interceptor the root {@link MethodInterceptor}.
* @param source The backing source object.
* @param projectionType the proxy target type.
* @return
*/
@Override
protected MethodInterceptor postProcessAccessorInterceptor(MethodInterceptor interceptor, Object source,
Class<?> projectionType) {
return typeCache.computeIfAbsent(projectionType, SpelAwareProxyProjectionFactory::hasMethodWithValueAnnotation)
? new SpelEvaluatingMethodInterceptor(interceptor, source, beanFactory, parser, projectionType)
: interceptor;
}
/*
* (non-Javadoc)
* @see org.springframework.data.projection.ProxyProjectionFactory#createProjectionInformation(java.lang.Class)
@@ -105,6 +87,24 @@ public class SpelAwareProxyProjectionFactory extends ProxyProjectionFactory impl
};
}
/**
* Inspects the given target type for methods with {@link Value} annotations and caches the result. Will create a
* {@link SpelEvaluatingMethodInterceptor} if an annotation was found or return the delegate as is if not.
*
* @param interceptor the root {@link MethodInterceptor}.
* @param source The backing source object.
* @param projectionType the proxy target type.
* @return
*/
@Override
protected MethodInterceptor postProcessAccessorInterceptor(MethodInterceptor interceptor, Object source,
Class<?> projectionType) {
return typeCache.computeIfAbsent(projectionType, SpelAwareProxyProjectionFactory::hasMethodWithValueAnnotation)
? new SpelEvaluatingMethodInterceptor(interceptor, source, beanFactory, parser, projectionType)
: interceptor;
}
/**
* Returns whether the given type as a method annotated with {@link Value}.
*