Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

review refactor: Add a new way to build a query in QueryFactory #1740

Merged
merged 3 commits into from
Nov 22, 2017
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions src/main/java/spoon/reflect/factory/Factory.java
Original file line number Diff line number Diff line change
Expand Up @@ -915,4 +915,9 @@ public interface Factory {
* @see CoreFactory#create(Class)
*/
CtElement createElement(Class<? extends CtElement> klass);

/**
* @see QueryFactory#createQuery(Object...)
*/
CtQuery createQuery(Object... input);
}
5 changes: 5 additions & 0 deletions src/main/java/spoon/reflect/factory/FactoryImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -1167,4 +1167,9 @@ public CtPackage createPackage(CtPackage parent, String simpleName) {
public CtElement createElement(Class<? extends CtElement> klass) {
return Core().create(klass);
}

@Override
public CtQuery createQuery(Object... input) {
return Query().createQuery(input);
}
}
8 changes: 8 additions & 0 deletions src/main/java/spoon/reflect/factory/QueryFactory.java
Original file line number Diff line number Diff line change
Expand Up @@ -48,4 +48,12 @@ public CtQuery createQuery() {
public CtQuery createQuery(Object input) {
return new CtQueryImpl(input);
}

/**
* Creates a bound query with an optional number of inputs
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what is the meaning of inputs?

not fan of pointing to an implementation in an interface.

* See {@link CtQueryImpl#CtQueryImpl(Object...)}
*/
public CtQuery createQuery(Object... input) {
return new CtQueryImpl(input);
}
}