-
Notifications
You must be signed in to change notification settings - Fork 48
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix #23 Stop using illegal reflective access
- Loading branch information
1 parent
de94ecf
commit 035f8ca
Showing
5 changed files
with
93 additions
and
46 deletions.
There are no files selected for viewing
34 changes: 34 additions & 0 deletions
34
...m/cosium/spring/data/jpa/entity/graph/repository/query/EntityGraphAwareJpaParameters.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
package com.cosium.spring.data.jpa.entity.graph.repository.query; | ||
|
||
import com.cosium.spring.data.jpa.entity.graph.domain.EntityGraph; | ||
import java.lang.reflect.Method; | ||
import org.springframework.core.MethodParameter; | ||
import org.springframework.data.jpa.repository.query.JpaParameters; | ||
|
||
/** @author Réda Housni Alaoui */ | ||
class EntityGraphAwareJpaParameters extends JpaParameters { | ||
|
||
public EntityGraphAwareJpaParameters(Method method) { | ||
super(method); | ||
} | ||
|
||
@Override | ||
protected JpaParameter createParameter(MethodParameter parameter) { | ||
return new EntityGraphAwareJpaParameter(parameter); | ||
} | ||
|
||
private static class EntityGraphAwareJpaParameter extends JpaParameters.JpaParameter { | ||
|
||
private final MethodParameter parameter; | ||
|
||
protected EntityGraphAwareJpaParameter(MethodParameter parameter) { | ||
super(parameter); | ||
this.parameter = parameter; | ||
} | ||
|
||
@Override | ||
public boolean isBindable() { | ||
return !EntityGraph.class.equals(parameter.getParameterType()) && super.isBindable(); | ||
} | ||
} | ||
} |
25 changes: 25 additions & 0 deletions
25
.../cosium/spring/data/jpa/entity/graph/repository/query/EntityGraphAwareJpaQueryMethod.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package com.cosium.spring.data.jpa.entity.graph.repository.query; | ||
|
||
import java.lang.reflect.Method; | ||
import org.springframework.data.jpa.provider.QueryExtractor; | ||
import org.springframework.data.jpa.repository.query.JpaParameters; | ||
import org.springframework.data.jpa.repository.query.JpaQueryMethod; | ||
import org.springframework.data.projection.ProjectionFactory; | ||
import org.springframework.data.repository.core.RepositoryMetadata; | ||
|
||
/** @author Réda Housni Alaoui */ | ||
class EntityGraphAwareJpaQueryMethod extends JpaQueryMethod { | ||
|
||
protected EntityGraphAwareJpaQueryMethod( | ||
Method method, | ||
RepositoryMetadata metadata, | ||
ProjectionFactory factory, | ||
QueryExtractor extractor) { | ||
super(method, metadata, factory, extractor); | ||
} | ||
|
||
@Override | ||
protected JpaParameters createParameters(Method method) { | ||
return new EntityGraphAwareJpaParameters(method); | ||
} | ||
} |
24 changes: 24 additions & 0 deletions
24
.../spring/data/jpa/entity/graph/repository/query/EntityGraphAwareJpaQueryMethodFactory.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package com.cosium.spring.data.jpa.entity.graph.repository.query; | ||
|
||
import java.lang.reflect.Method; | ||
import org.springframework.data.jpa.provider.QueryExtractor; | ||
import org.springframework.data.jpa.repository.query.JpaQueryMethod; | ||
import org.springframework.data.jpa.repository.query.JpaQueryMethodFactory; | ||
import org.springframework.data.projection.ProjectionFactory; | ||
import org.springframework.data.repository.core.RepositoryMetadata; | ||
|
||
/** @author Réda Housni Alaoui */ | ||
public class EntityGraphAwareJpaQueryMethodFactory implements JpaQueryMethodFactory { | ||
|
||
private final QueryExtractor extractor; | ||
|
||
public EntityGraphAwareJpaQueryMethodFactory(QueryExtractor extractor) { | ||
this.extractor = extractor; | ||
} | ||
|
||
@Override | ||
public JpaQueryMethod build( | ||
Method method, RepositoryMetadata metadata, ProjectionFactory factory) { | ||
return new EntityGraphAwareJpaQueryMethod(method, metadata, factory, extractor); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 2 additions & 3 deletions
5
.../spring/data/jpa/entity/graph/repository/support/EntityGraphJpaRepositoryFactoryBean.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters