mirror of
https://github.com/FalsePattern/FalsePatternLib.git
synced 2026-11-16 21:05:10 +00:00
make utility methods separate classes, removing downstream boilerplate
This commit is contained in:
2 files changed
+28
-26
No files matched your search
@@ -6,15 +6,6 @@ import java.nio.file.Path;
|
||||
import java.util.function.Predicate;
|
||||
|
||||
public interface ITargetedMod {
|
||||
static Predicate<String> startsWith(String subString) {
|
||||
return (name) -> name.startsWith(subString);
|
||||
}
|
||||
static Predicate<String> contains(String subString) {
|
||||
return (name) -> name.contains(subString);
|
||||
}
|
||||
static Predicate<String> matches(String regex) {
|
||||
return (name) -> name.matches(regex);
|
||||
}
|
||||
|
||||
String getModName();
|
||||
Predicate<String> getCondition();
|
||||
@@ -28,7 +19,17 @@ public interface ITargetedMod {
|
||||
return "jar".equals(fileExtension) && getCondition().test(nameLowerCase);
|
||||
}
|
||||
|
||||
default String toStringDefault() {
|
||||
return String.format("TargetedMod{%s}", getModName());
|
||||
final class PredicateHelpers {
|
||||
public static Predicate<String> startsWith(String subString) {
|
||||
return (name) -> name.startsWith(subString);
|
||||
}
|
||||
|
||||
public static Predicate<String> contains(String subString) {
|
||||
return (name) -> name.contains(subString);
|
||||
}
|
||||
|
||||
public static Predicate<String> matches(String regex) {
|
||||
return (name) -> name.matches(regex);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user