Skip to content

Commit

Permalink
Rework ClassMatcher-s (used for veto) to take on account indirect inh…
Browse files Browse the repository at this point in the history
…eritance
  • Loading branch information
vsilaev committed Jan 5, 2022
1 parent 0135e76 commit d596057
Showing 1 changed file with 11 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -71,41 +71,45 @@ ClassMatchStrategy parse(URL url) throws IOException {
}

static interface StrategyFactory {
ClassMatchStrategy create(String className);
ClassMatchStrategy create(String option);
}

static enum VariantFactory {
static enum VariantFactory implements StrategyFactory {
NAME_FULL() {
ClassMatchStrategy create(String option) {
@Override
public ClassMatchStrategy create(String option) {
return ClassMatchStrategies.byClassName(option, false);
}
},
NAME_PART() {
ClassMatchStrategy create(String option) {
@Override
public ClassMatchStrategy create(String option) {
return ClassMatchStrategies.byClassName(option, true);
}
},
NAME_PATTERN() {
ClassMatchStrategy create(String option) {
@Override
public ClassMatchStrategy create(String option) {
return ClassMatchStrategies.byClassNamePattern(option);
}
};

abstract ClassMatchStrategy create(String option);
}

static enum KindFactory {
CLASS() {
@Override
ClassMatchStrategy create(ClassMatchStrategy nested) {
return nested;
}
},
EXTENDS_CLASS() {
@Override
ClassMatchStrategy create(ClassMatchStrategy nested) {
return ClassMatchStrategies.bySuperClass(nested);
}
},
IMPLEMENTS_INTERFACE() {
@Override
ClassMatchStrategy create(ClassMatchStrategy nested) {
return ClassMatchStrategies.byInterface(nested);
}
Expand Down

0 comments on commit d596057

Please sign in to comment.