org.qi4j.api.query

## Class QueryExpressions

- java.lang.Object
- - org.qi4j.api.query.QueryExpressions

-     public final class QueryExpressions
      extends Object

  Static factory methods for query expressions and operators.

- - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `static AndSpecification` | `and(Specification<Composite> left, Specification<Composite> right, Specification<Composite>... optionalRight)` Create a new AND specification.
    `static <T> AssociationFunction<T>` | `association(Association<T> association)` Create a new Query Template AssociationFunction.
    `static <T> ManyAssociationContainsSpecification<T>` | `contains(ManyAssociation<T> manyAssoc, T value)` Create a new CONTAINS specification for a ManyAssociation.
    `static <T> NamedAssociationContainsSpecification<T>` | `contains(NamedAssociation<T> namedAssoc, T value)` Create a new CONTAINS specification for a NamedAssociation.
    `static <T> ContainsSpecification<T>` | `contains(Property<? extends Collection<T>> collectionProperty, T value)` Create a new CONTAINS specification for a Collection Property.
    `static <T> ContainsSpecification<T>` | `contains(Property<? extends Collection<T>> collectionProperty, Variable variable)` Create a new CONTAINS specification for a Collection Property using named Variables.
    `static <T> ContainsAllSpecification<T>` | `containsAll(Property<? extends Collection<T>> collectionProperty, Iterable<T> values)` Create a new CONTAINS ALL specification for a Collection Property.
    `static <T> ContainsAllSpecification<T>` | `containsAllVariables(Property<? extends Collection<T>> collectionProperty, Iterable<Variable> variables)` Create a new CONTAINS ALL specification for a Collection Property using named Variables.
    `static <T> NamedAssociationContainsNameSpecification<T>` | `containsName(NamedAssociation<T> namedAssoc, String name)` Create a new CONTAINS NAME specification for a NamedAssociation.
    `static <T> EqSpecification<String>` | `eq(Association<T> association, T value)` Create a new EQUALS specification for an Association.
    `static <T> EqSpecification<T>` | `eq(Property<T> property, T value)` Create a new EQUALS specification for a Property.
    `static <T> EqSpecification<T>` | `eq(Property<T> property, Variable variable)` Create a new EQUALS specification for a Property using a named Variable.
    `static <T> GeSpecification<T>` | `ge(Property<T> property, T value)` Create a new GREATER OR EQUALS specification for a Property.
    `static <T> GeSpecification<T>` | `ge(Property<T> property, Variable variable)` Create a new GREATER OR EQUALS specification for a Property using a named Variable.
    `static <T> GtSpecification<T>` | `gt(Property<T> property, T value)` Create a new GREATER THAN specification for a Property.
    `static <T> GtSpecification<T>` | `gt(Property<T> property, Variable variable)` Create a new GREATER THAN specification for a Property using a named Variable.
    `static <T> AssociationNotNullSpecification<T>` | `isNotNull(Association<T> association)` Create a new NOT NULL specification for an Association.
    `static <T> PropertyNotNullSpecification<T>` | `isNotNull(Property<T> property)` Create a new NOT NULL specification for a Property.
    `static <T> AssociationNullSpecification<T>` | `isNull(Association<T> association)` Create a new NULL specification for an Association.
    `static <T> PropertyNullSpecification<T>` | `isNull(Property<T> property)` Create a new NULL specification for a Property.
    `static <T> LeSpecification<T>` | `le(Property<T> property, T value)` Create a new LESS OR EQUALS specification for a Property.
    `static <T> LeSpecification<T>` | `le(Property<T> property, Variable variable)` Create a new LESS OR EQUALS specification for a Property using a named Variable.
    `static <T> LtSpecification<T>` | `lt(Property<T> property, T value)` Create a new LESSER THAN specification for a Property.
    `static <T> LtSpecification<T>` | `lt(Property<T> property, Variable variable)` Create a new LESSER THAN specification for a Property using a named Variable.
    `static <T> ManyAssociationFunction<T>` | `manyAssociation(ManyAssociation<T> association)` Create a new Query Template ManyAssociationFunction.
    `static MatchesSpecification` | `matches(Property<String> property, String regexp)` Create a new REGULAR EXPRESSION specification for a Property.
    `static MatchesSpecification` | `matches(Property<String> property, Variable variable)` Create a new REGULAR EXPRESSION specification for a Property using a named Variable.
    `static <T> NamedAssociationFunction<T>` | `namedAssociation(NamedAssociation<T> association)` Create a new Query Template NamedAssociationFunction.
    `static <T> NeSpecification<T>` | `ne(Property<T> property, T value)` Create a new NOT EQUALS specification for a Property.
    `static <T> NeSpecification<T>` | `ne(Property<T> property, Variable variable)` Create a new NOT EQUALS specification for a Property using a named Variable.
    `static NotSpecification` | `not(Specification<Composite> operand)` Create a new NOT specification.
    `static <T> T` | `oneOf(ManyAssociation<T> association)`
    `static <T> T` | `oneOf(NamedAssociation<T> association)`
    `static OrSpecification` | `or(Specification<Composite>... specs)` Create a new OR specification.
    `static <T> OrderBy` | `orderBy(Property<T> property)` Create a new Query ascending order segment for a Property.
    `static <T> OrderBy` | `orderBy(Property<T> property, OrderBy.Order order)` Create a new Query ordering segment for a Property.
    `static <T> Property<T>` | `property(Class<?> mixinClass, String fieldName)` Create a new Query Property instance.
    `static <T> PropertyFunction<T>` | `property(Property<T> property)` Create a new Query Template PropertyFunction.
    `static <T> T` | `templateFor(Class<T> clazz)` Create a Query Template using the given type.
    `static <T> T` | `templateFor(Class<T> mixinType, Association<?> association)` Create a Query Template using the given mixin class and association.
    `static Variable` | `variable(String name)` Create a new Query Variable.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Method Detail

    - #### templateFor

          public static <T> T templateFor(Class<T> clazz)

      Create a Query Template using the given type.
      Type Parameters:
        `T` - the type of the template
      Parameters:
        `clazz` - a class declaring the type of the template
      Returns:
        a new Query Template

    - #### templateFor

          public static <T> T templateFor(Class<T> mixinType,
                          Association<?> association)

      Create a Query Template using the given mixin class and association.
      Type Parameters:
        `T` - the type of the template
      Parameters:
        `mixinType` - a class declaring the type of the template
        `association` - an association
      Returns:
        a new Query Template

    - #### oneOf

          public static <T> T oneOf(ManyAssociation<T> association)

    - #### oneOf

          public static <T> T oneOf(NamedAssociation<T> association)

    - #### variable

          public static Variable variable(String name)

      Create a new Query Variable.
      Parameters:
        `name` - a name for the Variable
      Returns:
        a new Query Variable.

    - #### property

          public static <T> PropertyFunction<T> property(Property<T> property)

      Create a new Query Template PropertyFunction.
      Type Parameters:
        `T` - type of the Property
      Parameters:
        `property` - a Property
      Returns:
        a new Query Template PropertyFunction

    - #### property

          public static <T> Property<T> property(Class<?> mixinClass,
                                 String fieldName)

      Create a new Query Property instance.
      Type Parameters:
        `T` - type of the Property
      Parameters:
        `mixinClass` - mixin of the Property
        `fieldName` - name of the Property field
      Returns:
        a new Query Property instance for the given mixin and property name.

    - #### association

          public static <T> AssociationFunction<T> association(Association<T> association)

      Create a new Query Template AssociationFunction.
      Type Parameters:
        `T` - type of the Association
      Parameters:
        `association` - an Association
      Returns:
        a new Query Template AssociationFunction

    - #### manyAssociation

          public static <T> ManyAssociationFunction<T> manyAssociation(ManyAssociation<T> association)

      Create a new Query Template ManyAssociationFunction.
      Type Parameters:
        `T` - type of the ManyAssociation
      Parameters:
        `association` - a ManyAssociation
      Returns:
        a new Query Template ManyAssociationFunction

    - #### namedAssociation

          public static <T> NamedAssociationFunction<T> namedAssociation(NamedAssociation<T> association)

      Create a new Query Template NamedAssociationFunction.
      Type Parameters:
        `T` - type of the NamedAssociation
      Parameters:
        `association` - a NamedAssociation
      Returns:
        a new Query Template NamedAssociationFunction

    - #### and

          @SafeVarargs
          public static AndSpecification and(Specification<Composite> left,
                                         Specification<Composite> right,
                                         Specification<Composite>... optionalRight)

      Create a new AND specification.
      Parameters:
        `left` - first operand
        `right` - second operand
        `optionalRight` - optional operands
      Returns:
        a new AND specification

    - #### or

          @SafeVarargs
          public static OrSpecification or(Specification<Composite>... specs)

      Create a new OR specification.
      Parameters:
        `specs` - operands
      Returns:
        a new OR specification

    - #### not

          public static NotSpecification not(Specification<Composite> operand)

      Create a new NOT specification.
      Parameters:
        `operand` - specification to be negated
      Returns:
        a new NOT specification

    - #### eq

          public static <T> EqSpecification<T> eq(Property<T> property,
                                  T value)

      Create a new EQUALS specification for a Property.
      Parameters:
        `property` - a Property
        `value` - its value
      Returns:
        a new EQUALS specification for a Property.

    - #### eq

          public static <T> EqSpecification<T> eq(Property<T> property,
                                  Variable variable)

      Create a new EQUALS specification for a Property using a named Variable.
      Parameters:
        `property` - a Property
        `variable` - a Query Variable
      Returns:
        a new EQUALS specification for a Property using a named Variable.

    - #### eq

          public static <T> EqSpecification<String> eq(Association<T> association,
                                       T value)

      Create a new EQUALS specification for an Association.
      Parameters:
        `association` - an Association
        `value` - its value
      Returns:
        a new EQUALS specification for an Association.

    - #### ge

          public static <T> GeSpecification<T> ge(Property<T> property,
                                  T value)

      Create a new GREATER OR EQUALS specification for a Property.
      Parameters:
        `property` - a Property
        `value` - its value
      Returns:
        a new GREATER OR EQUALS specification for a Property.

    - #### ge

          public static <T> GeSpecification<T> ge(Property<T> property,
                                  Variable variable)

      Create a new GREATER OR EQUALS specification for a Property using a named Variable.
      Parameters:
        `property` - a Property
        `variable` - a Query Variable
      Returns:
        a new GREATER OR EQUALS specification for a Property using a named Variable.

    - #### gt

          public static <T> GtSpecification<T> gt(Property<T> property,
                                  T value)

      Create a new GREATER THAN specification for a Property.
      Parameters:
        `property` - a Property
        `value` - its value
      Returns:
        a new GREATER THAN specification for a Property.

    - #### gt

          public static <T> GtSpecification<T> gt(Property<T> property,
                                  Variable variable)

      Create a new GREATER THAN specification for a Property using a named Variable.
      Parameters:
        `property` - a Property
        `variable` - a Query Variable
      Returns:
        a new GREATER THAN specification for a Property using a named Variable.

    - #### le

          public static <T> LeSpecification<T> le(Property<T> property,
                                  T value)

      Create a new LESS OR EQUALS specification for a Property.
      Parameters:
        `property` - a Property
        `value` - its value
      Returns:
        a new LESS OR EQUALS specification for a Property.

    - #### le

          public static <T> LeSpecification<T> le(Property<T> property,
                                  Variable variable)

      Create a new LESS OR EQUALS specification for a Property using a named Variable.
      Parameters:
        `property` - a Property
        `variable` - a Query Variable
      Returns:
        a new LESS OR EQUALS specification for a Property using a named Variable.

    - #### lt

          public static <T> LtSpecification<T> lt(Property<T> property,
                                  T value)

      Create a new LESSER THAN specification for a Property.
      Parameters:
        `property` - a Property
        `value` - its value
      Returns:
        a new LESSER THAN specification for a Property.

    - #### lt

          public static <T> LtSpecification<T> lt(Property<T> property,
                                  Variable variable)

      Create a new LESSER THAN specification for a Property using a named Variable.
      Parameters:
        `property` - a Property
        `variable` - a Query Variable
      Returns:
        a new LESSER THAN specification for a Property using a named Variable.

    - #### ne

          public static <T> NeSpecification<T> ne(Property<T> property,
                                  T value)

      Create a new NOT EQUALS specification for a Property.
      Parameters:
        `property` - a Property
        `value` - its value
      Returns:
        a new NOT EQUALS specification for a Property.

    - #### ne

          public static <T> NeSpecification<T> ne(Property<T> property,
                                  Variable variable)

      Create a new NOT EQUALS specification for a Property using a named Variable.
      Parameters:
        `property` - a Property
        `variable` - a Query Variable
      Returns:
        a new NOT EQUALS specification for a Property using a named Variable.

    - #### matches

          public static MatchesSpecification matches(Property<String> property,
                                     String regexp)

      Create a new REGULAR EXPRESSION specification for a Property.
      Parameters:
        `property` - a Property
        `regexp` - its value
      Returns:
        a new REGULAR EXPRESSION specification for a Property.

    - #### matches

          public static MatchesSpecification matches(Property<String> property,
                                     Variable variable)

      Create a new REGULAR EXPRESSION specification for a Property using a named Variable.
      Parameters:
        `property` - a Property
        `variable` - a Query Variable
      Returns:
        a new REGULAR EXPRESSION specification for a Property using a named Variable.

    - #### isNotNull

          public static <T> PropertyNotNullSpecification<T> isNotNull(Property<T> property)

      Create a new NOT NULL specification for a Property.
      Parameters:
        `property` - a Property
      Returns:
        a new NOT NULL specification for a Property.

    - #### isNull

          public static <T> PropertyNullSpecification<T> isNull(Property<T> property)

      Create a new NULL specification for a Property.
      Parameters:
        `property` - a Property
      Returns:
        a new NULL specification for a Property.

    - #### isNotNull

          public static <T> AssociationNotNullSpecification<T> isNotNull(Association<T> association)

      Create a new NOT NULL specification for an Association.
      Parameters:
        `association` - an Association
      Returns:
        a new NOT NULL specification for an Association.

    - #### isNull

          public static <T> AssociationNullSpecification<T> isNull(Association<T> association)

      Create a new NULL specification for an Association.
      Parameters:
        `association` - an Association
      Returns:
        a new NULL specification for an Association.

    - #### containsAll

          public static <T> ContainsAllSpecification<T> containsAll(Property<? extends Collection<T>> collectionProperty,
                                                    Iterable<T> values)

      Create a new CONTAINS ALL specification for a Collection Property.
      Parameters:
        `collectionProperty` - a Collection Property
        `values` - its values
      Returns:
        a new CONTAINS ALL specification for a Collection Property.

    - #### containsAllVariables

          public static <T> ContainsAllSpecification<T> containsAllVariables(Property<? extends Collection<T>> collectionProperty,
                                                             Iterable<Variable> variables)

      Create a new CONTAINS ALL specification for a Collection Property using named Variables.
      Parameters:
        `collectionProperty` - a Collection Property
        `variables` - named Variables
      Returns:
        a new CONTAINS ALL specification for a Collection Property using named Variables.

    - #### contains

          public static <T> ContainsSpecification<T> contains(Property<? extends Collection<T>> collectionProperty,
                                              T value)

      Create a new CONTAINS specification for a Collection Property.
      Parameters:
        `collectionProperty` - a Collection Property
        `value` - the value
      Returns:
        a new CONTAINS specification for a Collection Property.

    - #### contains

          public static <T> ContainsSpecification<T> contains(Property<? extends Collection<T>> collectionProperty,
                                              Variable variable)

      Create a new CONTAINS specification for a Collection Property using named Variables.
      Parameters:
        `collectionProperty` - a Collection Property
        `variable` - named Variable
      Returns:
        a new CONTAINS specification for a Collection Property using named Variables.

    - #### contains

          public static <T> ManyAssociationContainsSpecification<T> contains(ManyAssociation<T> manyAssoc,
                                                             T value)

      Create a new CONTAINS specification for a ManyAssociation.
      Parameters:
        `manyAssoc` - a ManyAssociation
        `value` - the value
      Returns:
        a new CONTAINS specification for a ManyAssociation.

    - #### contains

          public static <T> NamedAssociationContainsSpecification<T> contains(NamedAssociation<T> namedAssoc,
                                                              T value)

      Create a new CONTAINS specification for a NamedAssociation.
      Parameters:
        `namedAssoc` - a NamedAssociation
        `value` - the value
      Returns:
        a new CONTAINS specification for a NamedAssociation.

    - #### containsName

          public static <T> NamedAssociationContainsNameSpecification<T> containsName(NamedAssociation<T> namedAssoc,
                                                                      String name)

      Create a new CONTAINS NAME specification for a NamedAssociation.
      Parameters:
        `namedAssoc` - a NamedAssociation
        `name` - the name
      Returns:
        a new CONTAINS NAME specification for a NamedAssociation.

    - #### orderBy

          public static <T> OrderBy orderBy(Property<T> property)

      Create a new Query ascending order segment for a Property.
      Type Parameters:
        `T` - type of the Property
      Parameters:
        `property` - a Property
      Returns:
        a new Query ascending order segment for a Property.

    - #### orderBy

          public static <T> OrderBy orderBy(Property<T> property,
                            OrderBy.Order order)

      Create a new Query ordering segment for a Property.
      Type Parameters:
        `T` - type of the Property
      Parameters:
        `property` - a Property
        `order` - ascending or descending
      Returns:
        a new Query ordering segment for a Property.