Class PBaseValueEqual<R,​T>

    • Constructor Detail

      • PBaseValueEqual

        public PBaseValueEqual​(String name,
                               R root)
        Construct with a property name and root instance.
        Parameters:
        name - property name
        root - the root query bean instance
    • Method Detail

      • asMapKey

        public final R asMapKey()
        Set the property as the map key for a findMap query.
        
        
           Map<String, Customer> map =
             new QCustomer()
               .organisation.id.equalTo(42)
               .email.asMapKey() // email property as map key
               .findMap();
        
         
        Returns:
        the root query bean instance
      • equalToOrNull

        public final R equalToOrNull​(T value)
        Is equal to or Null.
        Parameters:
        value - the equal to bind value
        Returns:
        the root query bean instance
      • equalTo

        public final R equalTo​(T value)
        Is equal to.
        Parameters:
        value - the equal to bind value
        Returns:
        the root query bean instance
      • eq

        public final R eq​(T value)
        Is equal to.
        Parameters:
        value - the equal to bind value
        Returns:
        the root query bean instance
      • notEqualTo

        public final R notEqualTo​(T value)
        Is not equal to.
        Parameters:
        value - the equal to bind value
        Returns:
        the root query bean instance
      • ne

        public final R ne​(T value)
        Is not equal to.
        Parameters:
        value - the equal to bind value
        Returns:
        the root query bean instance
      • in

        @SafeVarargs
        public final R in​(T... values)
        Is in a list of values.
        Parameters:
        values - the list of values for the predicate
        Returns:
        the root query bean instance
      • inOrEmpty

        public final R inOrEmpty​(Collection<T> values)
        In where null or empty values means that no predicate is added to the query.

        That is, only add the IN predicate if the values are not null or empty.

        Without this we typically need to code an if block to only add the IN predicate if the collection is not empty like:

        Without inOrEmpty()

        
        
           List<String> names = Arrays.asList("foo", "bar");
        
           QCustomer query = new QCustomer()
               .registered.before(LocalDate.now())
        
           // conditionally add the IN expression to the query
           if (names != null && !names.isEmpty()) {
               query.name.in(names)
           }
        
           query.findList();
        
         

        Using inOrEmpty()

        
        
           List<String> names = Arrays.asList("foo", "bar");
        
           new QCustomer()
               .registered.before(LocalDate.now())
               .name.inOrEmpty(names)
               .findList();
        
         
      • notIn

        @SafeVarargs
        public final R notIn​(T... values)
        Is NOT in a list of values.
        Parameters:
        values - the list of values for the predicate
        Returns:
        the root query bean instance
      • isIn

        @SafeVarargs
        public final R isIn​(T... values)
        Is in a list of values. Synonym for in().
        Parameters:
        values - the list of values for the predicate
        Returns:
        the root query bean instance
      • in

        public final R in​(Collection<T> values)
        Is in a list of values.
        Parameters:
        values - the list of values for the predicate
        Returns:
        the root query bean instance
      • notIn

        public final R notIn​(Collection<T> values)
        Is NOT in a list of values.
        Parameters:
        values - the list of values for the predicate
        Returns:
        the root query bean instance
      • isIn

        public final R isIn​(Collection<T> values)
        Is in a list of values. Synonym for in().
        Parameters:
        values - the list of values for the predicate
        Returns:
        the root query bean instance