/** * Expr: {@code this not like str} * * @param str * @return */ public BooleanExpression notLike(Expression<String> str) { return like(str).not(); }
/** * Expr: {@code this not like str} * * @param str * @return */ public BooleanExpression notLike(String str) { return like(str).not(); }
/** * Expr: {@code this not like str} * * @param str * @return */ public BooleanExpression notLike(String str, char escape) { return like(str, escape).not(); }
/** * Expr: {@code this not like str} * * @param str * @return */ public BooleanExpression notLike(Expression<String> str, char escape) { return like(str, escape).not(); }
/** * {@inheritDoc} */ @Override public <T> BooleanExpression createStringLikeExpression( PathBuilder<T> entityPath, String fieldName, String searchStr) { if (StringUtils.isEmpty(searchStr)) { return null; } String str = "%".concat(searchStr.toLowerCase()).concat("%"); BooleanExpression expression = entityPath.getString(fieldName).lower() .like(str); return expression; }
/** * Return like expression for {@code entityPath.fieldName}. * <p/> * Expr: {@code entityPath.fieldName like ('%' + searchStr + '%')} * <p/> * Like operation is case insensitive. * * @param entityPath Full path to entity and associations. For example: * {@code Pet} , {@code Pet.owner} * @param fieldName Property name in the given entity path. For example: * {@code name} in {@code Pet} entity, {@code firstName} in * {@code Pet.owner} entity. * @param searchStr the value to find, may be null * @return BooleanExpression */ public static <T> BooleanExpression createStringLikeExpression( PathBuilder<T> entityPath, String fieldName, String searchStr) { if (StringUtils.isEmpty(searchStr)) { return null; } String str = "%".concat(searchStr.toLowerCase()).concat("%"); BooleanExpression expression = entityPath.getString(fieldName).lower() .like(str); return expression; }
/** * {@inheritDoc} */ @Override @SuppressWarnings("unchecked") public <T, N extends Number & Comparable<?>> BooleanExpression createNumberExpressionEqual( PathBuilder<T> entityPath, String fieldName, Class<N> fieldType, TypeDescriptor descriptor, String searchStr) { if (StringUtils.isEmpty(searchStr)) { return null; } NumberPath<N> numberExpression = entityPath.getNumber(fieldName, fieldType); TypeDescriptor strDesc = STRING_TYPE_DESCRIPTOR; if (conversionService != null) { try { return numberExpression.eq((N) conversionService.convert( searchStr, strDesc, descriptor)); } catch (ConversionException ex) { return numberExpression.stringValue().like( "%".concat(searchStr).concat("%")); } } else { return numberExpression.stringValue().like( "%".concat(searchStr).concat("%")); } }
STRING_TYPE_DESCRIPTOR, descriptor); if (number == null) { expression = numberExpression.stringValue().like( "%".concat(searchStr).concat("%")); expression = numberExpression.stringValue().like( "%".concat(toSearch).concat("%")); expression = numberExpression.stringValue().like( "%".concat(searchStr).concat("%")); expression = numberExpression.stringValue().like( "%".concat(searchStr).concat("%"));
STRING_TYPE_DESCRIPTOR, descriptor); if (number == null) { expression = numberExpression.stringValue().like( "%".concat(searchStr).concat("%")); expression = numberExpression.stringValue().like( "%".concat(toSearch).concat("%")); expression = numberExpression.stringValue().like( "%".concat(searchStr).concat("%")); expression = numberExpression.stringValue().like( "%".concat(searchStr).concat("%"));
expression = dateExpression.stringValue().like( "%".concat(searchStr).concat("%"));
expression = dateExpression.stringValue().like( "%".concat(searchStr).concat("%"));