Class Restrictions

java.lang.Object
io.micronaut.data.model.query.factory.Restrictions

public class Restrictions extends Object
Factory for creating criterion instances.
Since:
1.0
Author:
graemerocher
  • Constructor Details

    • Restrictions

      public Restrictions()
  • Method Details

    • eq

      public static QueryModel.Equals eq(String property, Object parameter)
      Restricts the property to be equal to the given value.
      Parameters:
      property - The property
      parameter - The parameter that provides the value
      Returns:
      An instance of Query.Equals
    • idEq

      public static QueryModel.IdEquals idEq(Object parameter)
      Restricts the property to be equal to the given value.
      Parameters:
      parameter - The parameter that provides the value
      Returns:
      An instance of Query.Equals
    • versionEq

      public static QueryModel.VersionEquals versionEq(Object parameter)
      Restricts the property to be equal to the given value.
      Parameters:
      parameter - The parameter that provides the value
      Returns:
      An instance of Query.Equals
    • ne

      public static QueryModel.NotEquals ne(String property, Object parameter)
      Restricts the property to be not equal to the given value.
      Parameters:
      property - The property
      parameter - The parameter that provides the value
      Returns:
      An instance of Query.Equals
    • in

      public static QueryModel.In in(String property, Object parameter)
      Restricts the property to be in the list of given values.
      Parameters:
      property - The property
      parameter - The parameter that provides the value
      Returns:
      An instance of Query.In
    • notIn

      public static QueryModel.NotIn notIn(String property, Object parameter)
      Restricts the property to not be in the list of given values.
      Parameters:
      property - The property
      parameter - The parameter that provides the value
      Returns:
      An instance of Query.In
    • in

      public static QueryModel.In in(String property, QueryModel subquery)
      Restricts the property to be in the list of given values.
      Parameters:
      property - The property
      subquery - The subquery
      Returns:
      An instance of Query.In
    • notIn

      public static QueryModel.NotIn notIn(String property, QueryModel subquery)
      Restricts the property to be in the list of given values.
      Parameters:
      property - The property
      subquery - The subquery
      Returns:
      An instance of Query.In
    • like

      public static QueryModel.Like like(String property, Object expression)
      Restricts the property match the given String expressions. Expressions use SQL-like % to denote wildcards
      Parameters:
      property - The property name
      expression - The expression
      Returns:
      An instance of Query.Like
    • regex

      public static QueryModel.Regex regex(String property, Object expression)
      Restricts the property match the given regex expressions.
      Parameters:
      property - The property name
      expression - The expression
      Returns:
      An instance of Query.Like
    • startsWith

      public static QueryModel.StartsWith startsWith(String property, Object expression)
      Restricts the property match to strings starting with the given value.
      Parameters:
      property - The property name
      expression - The expression
      Returns:
      An instance of Query.StartsWith
    • contains

      public static QueryModel.Contains contains(String property, Object expression)
      Restricts the property match to strings containing the given value.
      Parameters:
      property - The property name
      expression - The expression
      Returns:
      An instance of Query.Constains
    • endsWith

      public static QueryModel.EndsWith endsWith(String property, Object expression)
      Restricts the property match to strings ending with the given value.
      Parameters:
      property - The property name
      expression - The expression
      Returns:
      An instance of Query.EndsWith
    • ilike

      public static QueryModel.ILike ilike(String property, Object expression)
      Case-insensitive like.
      Parameters:
      property - The property
      expression - The expression
      Returns:
      An ILike expression
    • rlike

      public static QueryModel.RLike rlike(String property, Object expression)
      Restricts the property match the given regular expressions.
      Parameters:
      property - The property name
      expression - The expression
      Returns:
      An instance of Query.RLike
    • and

      Logical OR.
      Parameters:
      a - The left criterion
      b - The right criterion
      Returns:
      The criterion
    • or

      Logical OR.
      Parameters:
      a - The left criterion
      b - The right criterion
      Returns:
      The criterion
    • between

      public static QueryModel.Between between(String property, Object start, Object end)
      Restricts the results by the given property value range.
      Parameters:
      property - The name of the property
      start - The start of the range
      end - The end of the range
      Returns:
      The Between instance
    • gt

      public static QueryModel.GreaterThan gt(String property, Object parameter)
      Used to restrict a value to be greater than the given value.
      Parameters:
      property - The property
      parameter - The parameter that provides the value
      Returns:
      The GreaterThan instance
    • lt

      public static QueryModel.LessThan lt(String property, Object parameter)
      Used to restrict a value to be less than the given value.
      Parameters:
      property - The property
      parameter - The parameter that provides the value
      Returns:
      The LessThan instance
    • gte

      public static QueryModel.GreaterThanEquals gte(String property, Object parameter)
      Used to restrict a value to be greater than or equal to the given value.
      Parameters:
      property - The property
      parameter - The parameter that provides the value
      Returns:
      The LessThan instance
    • lte

      public static QueryModel.LessThanEquals lte(String property, Object parameter)
      Used to restrict a value to be less than or equal to the given value.
      Parameters:
      property - The property
      parameter - The parameter that provides the value
      Returns:
      The LessThan instance
    • isNull

      public static QueryModel.IsNull isNull(String property)
      Used to restrict a value to be null.
      Parameters:
      property - The property name
      Returns:
      The IsNull instance
    • isEmpty

      public static QueryModel.IsEmpty isEmpty(String property)
      Used to restrict a value to be empty (such as a blank string or an empty collection).
      Parameters:
      property - The property name
      Returns:
      The IsEmpty instance
    • isNotEmpty

      public static QueryModel.IsNotEmpty isNotEmpty(String property)
      Used to restrict a value to be not empty (such as a non-blank string).
      Parameters:
      property - The property name
      Returns:
      The IsEmpty instance
    • isNotNull

      public static QueryModel.IsNotNull isNotNull(String property)
      Used to restrict a value to be null.
      Parameters:
      property - The property name
      Returns:
      The IsNull instance
    • isTrue

      public static QueryModel.IsTrue isTrue(String property)
      Used to restrict a value to be true.
      Parameters:
      property - The property name
      Returns:
      The true instance
    • isFalse

      public static QueryModel.IsFalse isFalse(String property)
      Used to restrict a value to be false.
      Parameters:
      property - The property name
      Returns:
      The true instance
    • sizeEq

      public static QueryModel.SizeEquals sizeEq(String property, Object size)
      Used to restrict the size of a collection property.
      Parameters:
      property - The property
      size - The size to restrict
      Returns:
      The result
    • sizeGt

      public static QueryModel.SizeGreaterThan sizeGt(String property, Object size)
      Used to restrict the size of a collection property to be greater than the given value.
      Parameters:
      property - The property
      size - The size to restrict
      Returns:
      The result
    • sizeGe

      public static QueryModel.SizeGreaterThanEquals sizeGe(String property, Object size)
      Used to restrict the size of a collection property to be greater than or equal to the given value.
      Parameters:
      property - The property
      size - The size to restrict
      Returns:
      The result
    • sizeLe

      public static QueryModel.SizeLessThanEquals sizeLe(String property, Object size)
      Creates a Criterion that contrains a collection property to be less than or equal to the given size.
      Parameters:
      property - The property name
      size - The size to constrain by
      Returns:
      A Criterion instance
    • sizeLt

      public static QueryModel.SizeLessThan sizeLt(String property, Object size)
      Creates a Criterion that contrains a collection property to be less than to the given size.
      Parameters:
      property - The property name
      size - The size to constrain by
      Returns:
      A Criterion instance
    • sizeNe

      public static QueryModel.SizeNotEquals sizeNe(String property, Object size)
      Creates a Criterion that contrains a collection property to be not equal to the given size.
      Parameters:
      property - The property name
      size - The size to constrain by
      Returns:
      A Criterion instance
    • eqProperty

      public static QueryModel.EqualsProperty eqProperty(String propertyName, String otherPropertyName)
      Constraints a property to be equal to a specified other property.
      Parameters:
      propertyName - The property
      otherPropertyName - The other property
      Returns:
      The criterion instance
    • neProperty

      public static QueryModel.NotEqualsProperty neProperty(String propertyName, String otherPropertyName)
      Constraints a property to be not equal to a specified other property.
      Parameters:
      propertyName - The property
      otherPropertyName - The other property
      Returns:
      This criterion instance
    • gtProperty

      public static QueryModel.GreaterThanProperty gtProperty(String propertyName, String otherPropertyName)
      Constraints a property to be greater than a specified other property.
      Parameters:
      propertyName - The property
      otherPropertyName - The other property
      Returns:
      The criterion
    • geProperty

      public static QueryModel.GreaterThanEqualsProperty geProperty(String propertyName, String otherPropertyName)
      Constraints a property to be greater than or equal to a specified other property.
      Parameters:
      propertyName - The property
      otherPropertyName - The other property
      Returns:
      The criterion
    • ltProperty

      public static QueryModel.LessThanProperty ltProperty(String propertyName, String otherPropertyName)
      Constraints a property to be less than a specified other property.
      Parameters:
      propertyName - The property
      otherPropertyName - The other property
      Returns:
      The criterion
    • leProperty

      public static QueryModel.LessThanEqualsProperty leProperty(String propertyName, String otherPropertyName)
      Constraints a property to be less than or equal to a specified other property.
      Parameters:
      propertyName - The property
      otherPropertyName - The other property
      Returns:
      The criterion
    • arrayContains

      public static QueryModel.ArrayContains arrayContains(String property, Object parameter)
      Restricts the property to be contained in the array.
      Parameters:
      property - The property
      parameter - The parameter that provides the value
      Returns:
      An instance of Query.ArrayContains