space.maxus.flare.util.CompoundValidator Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of flare Show documentation
Show all versions of flare Show documentation
Reactive Spigot Inventory UI Library
The newest version!
package space.maxus.flare.util;
import lombok.Data;
import java.util.List;
/**
* A compound validator that can validate multiple predicates at once
*/
@Data
public class CompoundValidator implements Validator {
private final List passes;
@Override
public boolean isValid(String input) {
return FlareUtil.reduceBoolStream(
passes.stream().map(each -> each.isValid(input)),
(a, b) -> a && b
);
}
@Override
public Validator and(Validator other) {
// avoiding creating another CompoundValidator here
this.passes.add(other);
return this;
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy