Skip to content

Commit

Permalink
HSEARCH-3088 Add DSL method id().matchingAny(...)
Browse files Browse the repository at this point in the history
  • Loading branch information
DavideD authored and yrodiere committed Nov 19, 2018
1 parent 44544b4 commit 001561c
Showing 1 changed file with 17 additions and 0 deletions.
Expand Up @@ -6,6 +6,8 @@
*/
package org.hibernate.search.engine.search.dsl.predicate;

import java.util.Collection;

/**
* The context used when defining a match on an identifier.
*/
Expand All @@ -16,8 +18,23 @@ public interface MatchIdPredicateContext extends SearchPredicateTerminalContext
* <p>
* If used multiple times, it will target any of the specified values.
* <p>
* @see #matchingAny(Collection)
* @param value the value of the id we want to match.
* @return {@code this} for method chaining.
*/
MatchIdPredicateContext matching(Object value);

/**
* Target the identifiers matching any of the values in a collection.
* <p>
* @param values the collection of identifiers to match.
* @return {@code this} for method chaining.
*/
default MatchIdPredicateContext matchingAny(Collection<Object> values) {
MatchIdPredicateContext context = null;
for ( Object value : values ) {
context = matching( value );
}
return context;
}
}

0 comments on commit 001561c

Please sign in to comment.