li.strolch.search.ExpressionBuilder Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of agent Show documentation
Show all versions of agent Show documentation
Strolch Agent which is the runtime for Strolch
The newest version!
package li.strolch.search;
import li.strolch.model.StrolchRootElement;
import li.strolch.utils.collections.DateRange;
import java.time.ZonedDateTime;
/**
* An interface to add search expressions to easily discover the possible search expressions
*/
public interface ExpressionBuilder {
Object extract(StrolchRootElement element);
default ValueCoercer getValueCoercer(StrolchRootElement context) {
return e -> e;
}
default SearchExpression isEmpty() {
return element -> PredicatesSupport.isEmpty().matches(extract(element));
}
default SearchExpression isEqualTo(Object right) {
return element -> PredicatesSupport.isEqualTo(right).matches(extract(element));
}
default SearchExpression isNotEqualTo(Object right) {
return element -> PredicatesSupport.isNotEqualTo(right).matches(extract(element));
}
default SearchExpression isEqualToIgnoreCase(Object right) {
return element -> PredicatesSupport.isEqualToIgnoreCase(right).matches(extract(element));
}
default SearchExpression isNotEqualToIgnoreCase(Object right) {
return element -> PredicatesSupport.isNotEqualToIgnoreCase(right).matches(extract(element));
}
default SearchExpression startsWith(Object right) {
return element -> PredicatesSupport.startsWith(right).matches(extract(element));
}
default SearchExpression startsWithIgnoreCase(Object right) {
return element -> PredicatesSupport.startsWithIgnoreCase(right).matches(extract(element));
}
default SearchExpression endsWith(Object right) {
return element -> PredicatesSupport.endsWith(right).matches(extract(element));
}
default SearchExpression endsWithIgnoreCase(Object right) {
return element -> PredicatesSupport.endsWithIgnoreCase(right).matches(extract(element));
}
default SearchExpression contains(Object right) {
return element -> PredicatesSupport.contains(right).matches(extract(element));
}
default SearchExpression collectionContains(Object right) {
return element -> PredicatesSupport.collectionContains(right).matches(extract(element));
}
default SearchExpression containsIgnoreCase(Object right) {
return element -> PredicatesSupport.containsIgnoreCase(right).matches(extract(element));
}
default SearchExpression containsIgnoreCaseMatchAny(Object right) {
return element -> PredicatesSupport.containsIgnoreCaseMatchAny(right).matches(extract(element));
}
default SearchExpression isIn(Object right) {
return element -> PredicatesSupport.isIn(right).matches(extract(element));
}
default SearchExpression isInIgnoreCase(Object right) {
return element -> PredicatesSupport.isInIgnoreCase(right).matches(extract(element));
}
default SearchExpression inRange(DateRange range) {
return element -> PredicatesSupport.inRange(range).matches(extract(element));
}
default SearchExpression isBefore(ZonedDateTime date, boolean inclusive) {
return element -> PredicatesSupport.isBefore(date, inclusive).matches(extract(element));
}
default SearchExpression isAfter(ZonedDateTime date, boolean inclusive) {
return element -> PredicatesSupport.isAfter(date, inclusive).matches(extract(element));
}
}