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

refactor: fix naming: RECURSIVE_WILCARD -> RECURSIVE_WILDCARD (re-introduced) #2213

Merged
merged 3 commits into from
Jul 15, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
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
2 changes: 1 addition & 1 deletion src/main/java/spoon/reflect/path/CtPathBuilder.java
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ public CtPathBuilder wildcard() {
* Add a recursive wildcard. It match on any child and sub-childs.
*/
public CtPathBuilder recursiveWildcard() {
return name(CtNamedPathElement.RECURSIVE_WILCARD);
return name(CtNamedPathElement.RECURSIVE_WILDCARD);
}

/**
Expand Down
10 changes: 4 additions & 6 deletions src/main/java/spoon/reflect/path/impl/CtNamedPathElement.java
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
public class CtNamedPathElement extends AbstractPathElement<CtElement, CtElement> {
public static final String STRING = ".";
public static final String WILDCARD = "*";
public static final String RECURSIVE_WILCARD = "**";
public static final String RECURSIVE_WILDCARD = "**";

private final String pattern;

Expand Down Expand Up @@ -58,7 +58,7 @@ public Collection<CtElement> getElements(Collection<CtElement> roots) {

public Collection<CtElement> scanElements(Collection<? extends CtElement> roots) {
NameScanner nameScanner = new NameScanner();
if (RECURSIVE_WILCARD.equals(pattern)) {
if (RECURSIVE_WILDCARD.equals(pattern)) {
nameScanner.recurse(roots);
} else {
nameScanner.scan(roots);
Expand All @@ -74,10 +74,9 @@ private class NameScanner extends CtInheritanceScanner {

@Override
public void scanCtElement(CtElement e) {
if (WILDCARD.equals(pattern) || RECURSIVE_WILCARD.equals(pattern)) {
if (WILDCARD.equals(pattern) || RECURSIVE_WILDCARD.equals(pattern)) {
results.add(e);
} else if (e instanceof CtNamedElement
&& ((CtNamedElement) e).getSimpleName().matches(pattern)) {
} else if (e instanceof CtNamedElement && ((CtNamedElement) e).getSimpleName().matches(pattern)) {
results.add(e);
}
}
Expand All @@ -93,5 +92,4 @@ public Collection<CtElement> getResults() {
return results;
}
}

}