Remove internal API builder method.

We came to the conclusion that we do not want to have builder
style access for our internal APIs but use explicit constructors.
This commit removes builder API and introduces public constructors.
This commit is contained in:
Gerrit Meier
2019-03-08 13:23:51 +01:00
parent 321946ac5b
commit c995b24a5a
3 changed files with 5 additions and 10 deletions

View File

@@ -36,12 +36,6 @@ public class Neo4jQueryMethod extends QueryMethod {
private final Method method;
private Neo4jQueryMethod(Method method, RepositoryMetadata metadata, ProjectionFactory factory) {
super(method, metadata, factory);
this.method = method;
}
/**
* Creates a new {@link Neo4jQueryMethod} from the given parameters. Looks up the correct query to use for following
* invocations of the method given.
@@ -50,8 +44,9 @@ public class Neo4jQueryMethod extends QueryMethod {
* @param metadata must not be {@literal null}.
* @param factory must not be {@literal null}.
*/
public static Neo4jQueryMethod of(Method method, RepositoryMetadata metadata, ProjectionFactory factory) {
return new Neo4jQueryMethod(method, metadata, factory);
public Neo4jQueryMethod(Method method, RepositoryMetadata metadata, ProjectionFactory factory) {
super(method, metadata, factory);
this.method = method;
}
/**

View File

@@ -95,7 +95,7 @@ class Neo4jRepositoryFactory extends RepositoryFactorySupport {
public RepositoryQuery resolveQuery(Method method, RepositoryMetadata metadata, ProjectionFactory factory,
NamedQueries namedQueries) {
Neo4jQueryMethod queryMethod = Neo4jQueryMethod.of(method, metadata, factory);
Neo4jQueryMethod queryMethod = new Neo4jQueryMethod(method, metadata, factory);
if (queryMethod.hasAnnotatedQuery()) {
return new StringBasedNeo4jQuery(queryMethod, neo4jOperations);
}

View File

@@ -53,7 +53,7 @@ class Neo4jQueryMethodTest {
Method method = repositoryClass.getMethod(name, parameters);
ProjectionFactory factory = new SpelAwareProxyProjectionFactory();
return Neo4jQueryMethod.of(method, new DefaultRepositoryMetadata(repositoryClass), factory);
return new Neo4jQueryMethod(method, new DefaultRepositoryMetadata(repositoryClass), factory);
}
interface PersonRepository extends Repository<Person, Long> {