List of usage examples for org.springframework.data.util AnnotationDetectionMethodCallback AnnotationDetectionMethodCallback
public AnnotationDetectionMethodCallback(Class<A> annotationType)
From source file:org.springframework.data.rest.core.projection.ProxyProjectionFactory.java
/** * 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. * //from w w w . ja va 2s . c o m * @param source The backing source object. * @param projectionType the proxy target type. * @param delegate the root {@link MethodInterceptor}. * @return */ private MethodInterceptor getSpelMethodInterceptorIfNecessary(Object source, Class<?> projectionType, MethodInterceptor delegate) { if (!typeCache.containsKey(projectionType)) { AnnotationDetectionMethodCallback<Value> callback = new AnnotationDetectionMethodCallback<Value>( Value.class); ReflectionUtils.doWithMethods(projectionType, callback); typeCache.put(projectionType, callback.hasFoundAnnotation()); } return typeCache.get(projectionType) ? new SpelEvaluatingMethodInterceptor(delegate, source, beanFactory) : delegate; }