com.jn.langx.util.boundary.CommonBoundary Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of langx-java Show documentation
Show all versions of langx-java Show documentation
Java lang extensions for java6+, a supplement to , replacement of a Guava, commons-lang.
Core utilities, Collection utilities, IO utilities, Cache, Configuration library ...
package com.jn.langx.util.boundary;
import com.jn.langx.util.Preconditions;
import com.jn.langx.util.collection.Collects;
import com.jn.langx.util.function.Predicate;
import java.util.List;
public class CommonBoundary implements Boundary {
private List> predicates = Collects.emptyArrayList();
@Override
public boolean test(final String value) {
Preconditions.checkNotEmpty(predicates);
return Collects.allMatch(predicates, new Predicate>() {
@Override
public boolean test(Predicate predicate) {
return predicate.test(value);
}
});
}
public void addPredicate(Predicate predicate) {
if (predicate != null) {
predicates.add(predicate);
}
}
}