Package org.hibernate.criterion
Class MoreRestrictions
- java.lang.Object
-
- org.hibernate.criterion.MoreRestrictions
-
public final class MoreRestrictions extends Object
Utility functions to ease creation of restrictions. The package was chosen to be able to pass escape chars to theLikeExpression.
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static org.hibernate.criterion.CriterionalwaysFalse()Creates a criterion that is alwaysfalse.static org.hibernate.criterion.CriterionalwaysTrue()Creates a criterion that is alwaystrue.static Optional<? extends org.hibernate.criterion.Criterion>and(Optional<? extends org.hibernate.criterion.Criterion>... criteria)static booleanhasConditions(org.hibernate.criterion.Junction j)static org.hibernate.criterion.LikeExpressionilike(String propertyName, String value, Character escapeChar)Create a new case-insensitive like expression.static org.hibernate.criterion.LikeExpressionilike(String propertyName, String value, String escapeString)Create a new case-insensitive like expression.static org.hibernate.criterion.LikeExpressionilike(String propertyName, String value, org.hibernate.criterion.MatchMode matchMode, Character escapeChar)Create a new case-insensitive like expression.static org.hibernate.criterion.LikeExpressionilike(String propertyName, String value, org.hibernate.criterion.MatchMode matchMode, String escapeString)Create a new case-insensitive like expression.static org.hibernate.criterion.LikeExpressionlike(String propertyName, String value)Create a new case-sensitive like expression.static org.hibernate.criterion.LikeExpressionlike(String propertyName, String value, Character escapeChar, boolean ignoreCase)Create a new like expression.static org.hibernate.criterion.LikeExpressionlike(String propertyName, String value, String escapeString, boolean ignoreCase)Create a new like expression.static org.hibernate.criterion.LikeExpressionlike(String propertyName, String value, org.hibernate.criterion.MatchMode matchMode)Create a new case-sensitive like expression.static org.hibernate.criterion.LikeExpressionlike(String propertyName, String value, org.hibernate.criterion.MatchMode matchMode, Character escapeChar, boolean ignoreCase)Create a new like expression.static org.hibernate.criterion.LikeExpressionlike(String propertyName, String value, org.hibernate.criterion.MatchMode matchMode, String escapeString, boolean ignoreCase)Create a new like expression.static Optional<? extends org.hibernate.criterion.Criterion>or(Optional<? extends org.hibernate.criterion.Criterion>... criteria)static Collector<org.hibernate.criterion.Criterion,?,org.hibernate.criterion.Criterion>toConjunction()Create aCollectorthat collects criterions to a conjunction.static Collector<org.hibernate.criterion.Criterion,?,org.hibernate.criterion.Criterion>toDisjunction()Create aCollectorthat collects criterions to a disjunction.
-
-
-
Method Detail
-
ilike
public static org.hibernate.criterion.LikeExpression ilike(String propertyName, String value, Character escapeChar)
Create a new case-insensitive like expression.- Parameters:
propertyName- the property namevalue- the value to compare againstescapeChar- the escape char to use- Returns:
- the expression
-
ilike
public static org.hibernate.criterion.LikeExpression ilike(String propertyName, String value, String escapeString)
Create a new case-insensitive like expression.- Parameters:
propertyName- the property namevalue- the value to compare againstescapeString- the escape string to use- Returns:
- the expression
-
ilike
public static org.hibernate.criterion.LikeExpression ilike(String propertyName, String value, org.hibernate.criterion.MatchMode matchMode, Character escapeChar)
Create a new case-insensitive like expression.- Parameters:
propertyName- the property namevalue- the value to compare againstmatchMode- the match modeescapeChar- the escape char to use- Returns:
- the expression
-
ilike
public static org.hibernate.criterion.LikeExpression ilike(String propertyName, String value, org.hibernate.criterion.MatchMode matchMode, String escapeString)
Create a new case-insensitive like expression.- Parameters:
propertyName- the property namevalue- the value to compare againstmatchMode- the match modeescapeString- the escape string to use- Returns:
- the expression
-
like
public static org.hibernate.criterion.LikeExpression like(String propertyName, String value, Character escapeChar, boolean ignoreCase)
Create a new like expression.- Parameters:
propertyName- the property namevalue- the value to compare againstescapeChar- the escape char to useignoreCase- if the match should be case-insensitive- Returns:
- the expression
-
like
public static org.hibernate.criterion.LikeExpression like(String propertyName, String value, String escapeString, boolean ignoreCase)
Create a new like expression.- Parameters:
propertyName- the property namevalue- the value to compare againstescapeString- the escape string to useignoreCase- if the match should be case-insensitive- Returns:
- the expression
-
like
public static org.hibernate.criterion.LikeExpression like(String propertyName, String value)
Create a new case-sensitive like expression.- Parameters:
propertyName- the property namevalue- the value to compare against- Returns:
- the expression
-
like
public static org.hibernate.criterion.LikeExpression like(String propertyName, String value, org.hibernate.criterion.MatchMode matchMode)
Create a new case-sensitive like expression.- Parameters:
propertyName- the property namevalue- the value to compare againstmatchMode- the match mode- Returns:
- the expression
-
like
public static org.hibernate.criterion.LikeExpression like(String propertyName, String value, org.hibernate.criterion.MatchMode matchMode, String escapeString, boolean ignoreCase)
Create a new like expression.- Parameters:
propertyName- the property namevalue- the value to compare againstmatchMode- the match modeescapeString- the escape string to useignoreCase- if the match should be case-insensitive- Returns:
- the expression
-
like
public static org.hibernate.criterion.LikeExpression like(String propertyName, String value, org.hibernate.criterion.MatchMode matchMode, Character escapeChar, boolean ignoreCase)
Create a new like expression.- Parameters:
propertyName- the property namevalue- the value to compare againstmatchMode- the match modeescapeChar- the escape char to useignoreCase- if the match should be case-insensitive- Returns:
- the expression
-
alwaysFalse
public static org.hibernate.criterion.Criterion alwaysFalse()
Creates a criterion that is alwaysfalse.- Returns:
- the criterion
-
alwaysTrue
public static org.hibernate.criterion.Criterion alwaysTrue()
Creates a criterion that is alwaystrue.- Returns:
- the criterion
-
toDisjunction
public static Collector<org.hibernate.criterion.Criterion,?,org.hibernate.criterion.Criterion> toDisjunction()
Create aCollectorthat collects criterions to a disjunction.- Returns:
- the collector
-
toConjunction
public static Collector<org.hibernate.criterion.Criterion,?,org.hibernate.criterion.Criterion> toConjunction()
Create aCollectorthat collects criterions to a conjunction.- Returns:
- the collector
-
and
@SafeVarargs public static Optional<? extends org.hibernate.criterion.Criterion> and(Optional<? extends org.hibernate.criterion.Criterion>... criteria)
-
or
@SafeVarargs public static Optional<? extends org.hibernate.criterion.Criterion> or(Optional<? extends org.hibernate.criterion.Criterion>... criteria)
-
hasConditions
public static boolean hasConditions(org.hibernate.criterion.Junction j)
-
-