tech.ydb.yoj.databind.expression.visitor.AnyMatch Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of yoj-databind Show documentation
Show all versions of yoj-databind Show documentation
Core data-binding logic used by YOJ (YDB ORM for Java) to convert
between Java objects and database rows (or anything representable by
a Java Map, really).
The newest version!
package tech.ydb.yoj.databind.expression.visitor;
import lombok.NonNull;
import lombok.RequiredArgsConstructor;
import tech.ydb.yoj.databind.expression.FilterExpression;
import tech.ydb.yoj.databind.expression.LeafExpression;
import java.util.function.Predicate;
@RequiredArgsConstructor
public final class AnyMatch extends FilterExpression.Visitor.Simple {
@NonNull
private final Predicate> predicate;
@Override
public Boolean visitLeaf(@NonNull LeafExpression leaf) {
return predicate.test(leaf);
}
@Override
protected Boolean visitComposite(@NonNull FilterExpression composite) {
return composite.stream().anyMatch(e -> e.visit(this));
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy