code: protected Predicate createPredicate(Path root, CriteriaQuery<?> query, CriteriaBuilder cb, String propertyName,
                                          ComparisonOperator operator, Object argument, PersistenceContext context)
      {
          logger.debug("Creating criterion: {} {} {}", propertyName, operator, argument);
  
          switch (operator)
          {
              case EQUAL:
              {
                  if (containWildcard(argument))
                  {
                      return createLike(root, query, cb, propertyName, argument, context);
                  }
                  else
                  {
                      return createEqual(root, query, cb, propertyName, argument, context);
                  }
              }
              case NOT_EQUAL:
              {
                  if (containWildcard(argument))
                  {
                      return createNotLike(root, query, cb, propertyName, argument, context);
                  }
                  else
                  {
                      return createNotEqual(root, query, cb, propertyName, argument, context);
                  }
              }
              case GREATER_THAN:
                  return createGreaterThan(root, query, cb, propertyName, argument, context);
              case GREATER_EQUAL:
                  return createGreaterEqual(root, query, cb, propertyName, argument, context);
              case LESS_THAN:
                  return createLessThan(root, query, cb, propertyName, argument, context);
              case LESS_EQUAL:
                  return createLessEqual(root, query, cb, propertyName, argument, context);
              case IN:
                  return createIn(root, query, cb, propertyName, argument, context);
              case NOT_IN:
                  return createNotIn(root, query, cb, propertyName, argument, context);
          }
          throw new IllegalArgumentException("Unknown operator: " + operator);
      }
docs: Delegate creating of a Predicate to an appropriate method according to
  operator.
  
  @param root         root
  @param query        query
  @param propertyName property name
  @param operator     comparison operator
  @param argument     argument
  @param context      context
  @return Predicate