Make RefPatternMatcher public so that it can be used from plugins
Change-Id: Ib57ecb0796ac8203db3da19681e0bb859f7f6b50 Signed-off-by: Edwin Kempin <edwin.kempin@sap.com>
This commit is contained in:
@@ -20,7 +20,7 @@ import dk.brics.automaton.Automaton;
|
|||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
abstract class RefPatternMatcher {
|
public abstract class RefPatternMatcher {
|
||||||
public static RefPatternMatcher getMatcher(String pattern) {
|
public static RefPatternMatcher getMatcher(String pattern) {
|
||||||
if (pattern.contains("${")) {
|
if (pattern.contains("${")) {
|
||||||
return new ExpandParameters(pattern);
|
return new ExpandParameters(pattern);
|
||||||
@@ -33,7 +33,7 @@ abstract class RefPatternMatcher {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
abstract boolean match(String ref, String username);
|
public abstract boolean match(String ref, String username);
|
||||||
|
|
||||||
private static class Exact extends RefPatternMatcher {
|
private static class Exact extends RefPatternMatcher {
|
||||||
private final String expect;
|
private final String expect;
|
||||||
@@ -43,7 +43,7 @@ abstract class RefPatternMatcher {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
boolean match(String ref, String username) {
|
public boolean match(String ref, String username) {
|
||||||
return expect.equals(ref);
|
return expect.equals(ref);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -56,7 +56,7 @@ abstract class RefPatternMatcher {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
boolean match(String ref, String username) {
|
public boolean match(String ref, String username) {
|
||||||
return ref.startsWith(prefix);
|
return ref.startsWith(prefix);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -69,7 +69,7 @@ abstract class RefPatternMatcher {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
boolean match(String ref, String username) {
|
public boolean match(String ref, String username) {
|
||||||
return pattern.matcher(ref).matches();
|
return pattern.matcher(ref).matches();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -98,7 +98,7 @@ abstract class RefPatternMatcher {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
boolean match(String ref, String username) {
|
public boolean match(String ref, String username) {
|
||||||
if (!ref.startsWith(prefix) || username == null) {
|
if (!ref.startsWith(prefix) || username == null) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ class SectionMatcher extends RefPatternMatcher {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
boolean match(String ref, String username) {
|
public boolean match(String ref, String username) {
|
||||||
return this.matcher.match(ref, username);
|
return this.matcher.match(ref, username);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user