DATAJPA-1173 - Polishing.

CollectionAwareProjectionInformation is now a static class. JavaDoc. Removed superfluous imports.

Original pull request: #218.
Related issue: DATACMNS-1158.
This commit is contained in:
Oliver Gierke
2017-11-24 11:50:53 +01:00
parent e8240b7af5
commit 21c7b0914c
2 changed files with 17 additions and 7 deletions

View File

@@ -27,20 +27,29 @@ import org.springframework.data.projection.SpelAwareProxyProjectionFactory;
* maps to be open.
*
* @author Jens Schauder
* @author Oliver Gierke
*/
public class CollectionAwareProjectionFactory extends SpelAwareProxyProjectionFactory {
/*
* (non-Javadoc)
* @see org.springframework.data.projection.SpelAwareProxyProjectionFactory#createProjectionInformation(java.lang.Class)
*/
@Override
protected ProjectionInformation createProjectionInformation(Class<?> projectionType) {
return new CollectionAwareProjectionInformation(projectionType);
}
private class CollectionAwareProjectionInformation extends SpelAwareProjectionInformation {
private static class CollectionAwareProjectionInformation extends SpelAwareProjectionInformation {
CollectionAwareProjectionInformation(Class<?> projectionType) {
super(projectionType);
}
/*
* (non-Javadoc)
* @see org.springframework.data.projection.SpelAwareProxyProjectionFactory.SpelAwareProjectionInformation#isInputProperty(java.beans.PropertyDescriptor)
*/
@Override
protected boolean isInputProperty(PropertyDescriptor descriptor) {
@@ -48,11 +57,8 @@ public class CollectionAwareProjectionFactory extends SpelAwareProxyProjectionFa
return false;
}
boolean isMapOrCollection = //
Collection.class.isAssignableFrom(descriptor.getPropertyType()) //
|| Map.class.isAssignableFrom(descriptor.getPropertyType());
return !isMapOrCollection;
return !(Collection.class.isAssignableFrom(descriptor.getPropertyType()) //
|| Map.class.isAssignableFrom(descriptor.getPropertyType()));
}
}
}

View File

@@ -29,7 +29,6 @@ import org.springframework.data.jpa.provider.QueryExtractor;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.query.JpaQueryLookupStrategy;
import org.springframework.data.projection.ProjectionFactory;
import org.springframework.data.projection.SpelAwareProxyProjectionFactory;
import org.springframework.data.querydsl.QuerydslPredicateExecutor;
import org.springframework.data.repository.core.RepositoryInformation;
import org.springframework.data.repository.core.RepositoryMetadata;
@@ -76,6 +75,7 @@ public class JpaRepositoryFactory extends RepositoryFactorySupport {
*/
@Override
public void setBeanClassLoader(ClassLoader classLoader) {
super.setBeanClassLoader(classLoader);
this.crudMethodMetadataPostProcessor.setBeanClassLoader(classLoader);
}
@@ -123,6 +123,10 @@ public class JpaRepositoryFactory extends RepositoryFactorySupport {
}
}
/*
* (non-Javadoc)
* @see org.springframework.data.repository.core.support.RepositoryFactorySupport#getProjectionFactory(java.lang.ClassLoader, org.springframework.beans.factory.BeanFactory)
*/
@Override
protected ProjectionFactory getProjectionFactory(ClassLoader classLoader, BeanFactory beanFactory) {