com.github.methylene.args.predicate.TokenPredicates Maven / Gradle / Ivy
The newest version!
package com.github.methylene.args.predicate;
import com.github.methylene.args.Predicate;
import com.github.methylene.args.Token;
public class TokenPredicates {
public static Predicate isValue() {
return new Predicate() {
@Override
public boolean matches(Token arg) {
return arg.isValue();
}
};
}
public static Predicate isFlag() {
return new Predicate() {
@Override
public boolean matches(Token arg) {
return arg.isFlag();
}
};
}
public static Predicate matches(final Predicate predicate) {
return new Predicate() {
@Override
public boolean matches(Token arg) {
return arg.isValue() && predicate.matches(arg.getValue());
}
};
}
}