本文整理汇总了Java中com.querydsl.core.types.dsl.StringPath类的典型用法代码示例。如果您正苦于以下问题:Java StringPath类的具体用法?Java StringPath怎么用?Java StringPath使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
StringPath类属于com.querydsl.core.types.dsl包,在下文中一共展示了StringPath类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: applyGlobalSearch
import com.querydsl.core.types.dsl.StringPath; //导入依赖的package包/类
/**
* Adds a global contains text filter on the provided attributes.
* WARNING: this creates a very inefficient query. If you have many entity
* instances to query, use instead an indexed text search solution for better
* performance.
* @param text the text to look for
* @param query
* @param globalSearchAttributes the list of attributes to perform the
* filter on
* @return the updated query
*/
protected JPQLQuery<T> applyGlobalSearch(String text, JPQLQuery<T> query,
Path<?>... globalSearchAttributes) {
if (text != null && !StringUtils.isEmpty(text) && globalSearchAttributes.length > 0) {
BooleanBuilder searchCondition = new BooleanBuilder();
for (int i = 0; i < globalSearchAttributes.length; i++) {
Path<?> path = globalSearchAttributes[i];
if (path instanceof StringPath) {
StringPath stringPath = (StringPath) path;
searchCondition.or(stringPath.containsIgnoreCase(text));
} else if (path instanceof NumberExpression) {
searchCondition.or(((NumberExpression<?>) path).like("%".concat(text).concat("%")));
}
}
return query.where(searchCondition);
}
return query;
}
示例2: listOrgs
import com.querydsl.core.types.dsl.StringPath; //导入依赖的package包/类
private List<OrgList.Org> listOrgs(final Locale locale,
final String viewedRhyHtaOfficialCode,
final EntityPathBase<?> hta,
final StringPath number,
final StringPath nameFinnish,
final StringPath nameSwedish) {
return jpqlQueryFactory.select(number, nameFinnish, nameSwedish)
.from(hta)
.fetch()
.stream()
.map(t -> {
final String name = LocalisedString.of(t.get(nameFinnish), t.get(nameSwedish))
.getAnyTranslation(locale);
final String officialCode = t.get(number);
return new OrgList.Org(officialCode, name, Objects.equals(officialCode, viewedRhyHtaOfficialCode));
})
.sorted(comparing(o -> o.name))
.collect(toList());
}
示例3: buildTextQuery
import com.querydsl.core.types.dsl.StringPath; //导入依赖的package包/类
private Predicate buildTextQuery(TextQuery txt, StringPath txtfield) {
if (txt.isEmpty()) {
return null;
}
BooleanBuilder predicate = new BooleanBuilder();
if (txt.getContains() != null) {
predicate.and(txtfield.contains(txt.getContains()));
}
if (txt.getStartWith() != null) {
predicate.and(txtfield.startsWith(txt.getStartWith()));
}
if (txt.getEndWith() != null) {
predicate.and(txtfield.endsWith(txt.getEndWith()));
}
if (txt.getEquals() != null) {
predicate.and(txtfield.endsWith(txt.getEquals()));
}
return predicate;
}
示例4: customize
import com.querydsl.core.types.dsl.StringPath; //导入依赖的package包/类
/**
* Override default QueryDsl bindings.
*
* @param bindings a QueryDslBindings to use
* @param root the QPatient root
*/
@Override
default void customize(QuerydslBindings bindings, QPatient root) {
bindings.excluding(root.id);
//bindings.excluding(root.patientId);
bindings.bind(String.class)
.first((StringPath path, String value) ->
path.containsIgnoreCase(value));
}
示例5: evaluate
import com.querydsl.core.types.dsl.StringPath; //导入依赖的package包/类
@Override
public BooleanExpression evaluate(StringPath path, ComparisonNode comparisonNode) {
ComparisonOperator comparisonOperator = comparisonNode.getOperator();
List<String> arguments = comparisonNode.getArguments();
String firstArg = arguments.get(0);
if (EQUAL.equals(comparisonOperator)) {
return ConverterConstant.NULL.equalsIgnoreCase(firstArg) ? path.isNull() : equal(path, firstArg);
} else if (NOT_EQUAL.equals(comparisonOperator)) {
return ConverterConstant.NULL.equalsIgnoreCase(firstArg) ? path.isNotNull() : equal(path, firstArg).not().or(path.isNull());
} else if (IN.equals(comparisonOperator)) {
return path.in(arguments);
} else if (NOT_IN.equals(comparisonOperator)) {
return path.notIn(arguments);
}
throw new UnsupportedRqlOperatorException(comparisonNode, path.getClass());
}
示例6: buildTextQuery
import com.querydsl.core.types.dsl.StringPath; //导入依赖的package包/类
private Predicate buildTextQuery(TextQuery txt, StringPath txtfield) {
if (txt.isEmpty()) {
return null;
}
BooleanBuilder predicate = new BooleanBuilder();
if (txt.getContains() != null) {
predicate.and(txtfield.contains(txt.getContains()));
}
if (txt.getStartWith() != null) {
predicate.and(txtfield.startsWith(txt.getStartWith()));
}
if (txt.getEndWith() != null) {
predicate.and(txtfield.endsWith(txt.getEndWith()));
}
if (txt.getEquals() != null) {
predicate.and(txtfield.endsWith(txt.getEquals()));
}
if (!txt.getIn().isEmpty()) {
predicate.and(txtfield.in(txt.getIn()));
}
return predicate;
}
示例7: buildListQuery
import com.querydsl.core.types.dsl.StringPath; //导入依赖的package包/类
private Predicate buildListQuery(StringListQuery query, ListPath<String, StringPath> list) {
if (query.isEmpty()) {
return null;
}
BooleanBuilder predicate = new BooleanBuilder();
if (query.getIn() != null && query.getIn().isEmpty()) {
predicate.and(list.any().in(query.getIn()));
}
return predicate;
}
示例8: getFieldByTag
import com.querydsl.core.types.dsl.StringPath; //导入依赖的package包/类
public StringPath getFieldByTag(ID3Helper.ID3Tag id3Tag) {
switch (id3Tag) {
case ALBUM:
return album;
case ALBUMARTIST:
return albumartist;
case ARTIST:
return artist;
case BPM:
return bpm;
case COMMENT:
return comment;
case COMPOSER:
return composer;
case DATE:
return date;
case GENRE:
return genre;
case LENGTH:
return length;
case PUBLISHER:
return publisher;
case RATING:
return rating;
case TITLE:
return title;
case TRACK:
return track;
case YEAR:
return year;
default:
return null;
}
}
示例9: customize
import com.querydsl.core.types.dsl.StringPath; //导入依赖的package包/类
@Override
default void customize(QuerydslBindings bindings, QMedication root) {
bindings.excluding(root.id);
bindings.bind(String.class)
.first((StringPath path, String value) ->
path.containsIgnoreCase(value));
}
示例10: customize
import com.querydsl.core.types.dsl.StringPath; //导入依赖的package包/类
@Override
default public void customize(QuerydslBindings bindings, QCustomer cust) {
// bindings.bind(cust.firstName).first(StringExpression::containsIgnoreCase);
bindings
.bind(String.class)
.first((SingleValueBinding<StringPath, String>) StringExpression::containsIgnoreCase);
bindings
.bind(Long.class)
.first((SingleValueBinding<NumberPath<Long>, Long>) NumberExpression::goe);
// bindings.excluding(cust.lastName);
}
示例11: getEntityByFieldIgnoreCase
import com.querydsl.core.types.dsl.StringPath; //导入依赖的package包/类
/**
* @deprecated Utiliser QueryDSL.
*/
@Deprecated
public <T> T getEntityByFieldIgnoreCase(Class<T> clazz, SingularAttribute<? super T, String> attribute, String fieldValue) {
PathBuilder<T> entityPath = new PathBuilder<T>(clazz, "rootAlias");
StringPath field = Expressions.stringPath(entityPath, attribute.getName());
return queryByPredicate(entityPath, field.equalsIgnoreCase(fieldValue)).fetchOne();
}
示例12: findPath
import com.querydsl.core.types.dsl.StringPath; //导入依赖的package包/类
private static StringPath findPath(Path<?>[] paths, String name) {
for (Path<?> path : paths) {
if (path.getMetadata().getName().equals(name)) {
return (StringPath) path;
}
}
throw new IllegalArgumentException("Path not found: " + name);
}
示例13: customize
import com.querydsl.core.types.dsl.StringPath; //导入依赖的package包/类
@Override
default public void customize(QuerydslBindings bindings, QUser root) {
bindings.bind(String.class).first((StringPath path, String value) -> path.containsIgnoreCase(value));
bindings.excluding(root.password);
}
示例14: findWhereExpression
import com.querydsl.core.types.dsl.StringPath; //导入依赖的package包/类
@Override
protected BooleanExpression findWhereExpression() {
StringPath deletedPath = propertyPath("deleted");
return deletedPath.isNull();
}
示例15: getPrimaryKey
import com.querydsl.core.types.dsl.StringPath; //导入依赖的package包/类
@Override
public StringPath getPrimaryKey() {
return qInstance.id;
}