当前位置: 首页>>代码示例>>Java>>正文


Java StringPath类代码示例

本文整理汇总了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;
}
 
开发者ID:DISID,项目名称:springlets,代码行数:29,代码来源:QueryDslRepositorySupportExt.java

示例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());
}
 
开发者ID:suomenriistakeskus,项目名称:oma-riista-web,代码行数:20,代码来源:MoosePermitStatisticsFeature.java

示例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;
    }
 
开发者ID:raptorbox,项目名称:raptor,代码行数:27,代码来源:DataQueryBuilder.java

示例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));
}
 
开发者ID:ssherwood,项目名称:spring-boot-jpa,代码行数:15,代码来源:PatientRepository.java

示例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());
}
 
开发者ID:vineey,项目名称:archelix-rsql,代码行数:18,代码来源:StringPathConverter.java

示例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;
    }
 
开发者ID:raptorbox,项目名称:raptor,代码行数:31,代码来源:TreeQueryBuilder.java

示例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;
    }
 
开发者ID:raptorbox,项目名称:raptor,代码行数:15,代码来源:AppQueryBuilder.java

示例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;
    }
}
 
开发者ID:MolaynoxX,项目名称:amperfi,代码行数:35,代码来源:QLibraryFile.java

示例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));
}
 
开发者ID:ssherwood,项目名称:spring-boot-jpa,代码行数:8,代码来源:MedicationRepository.java

示例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);
    }
 
开发者ID:Nandtel,项目名称:spring-data-jpa-querydsl-gradle-starter,代码行数:16,代码来源:CustomerRepository.java

示例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();
}
 
开发者ID:openwide-java,项目名称:owsi-core-parent,代码行数:11,代码来源:JpaDaoSupport.java

示例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);
}
 
开发者ID:HSLdevcom,项目名称:parkandrideAPI,代码行数:9,代码来源:AddressMapping.java

示例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);
}
 
开发者ID:Just-Fun,项目名称:spring-data-examples,代码行数:7,代码来源:UserRepository.java

示例14: findWhereExpression

import com.querydsl.core.types.dsl.StringPath; //导入依赖的package包/类
@Override
protected BooleanExpression findWhereExpression() {
    StringPath deletedPath = propertyPath("deleted");

    return deletedPath.isNull();
}
 
开发者ID:LIBCAS,项目名称:ARCLib,代码行数:7,代码来源:DatedStore.java

示例15: getPrimaryKey

import com.querydsl.core.types.dsl.StringPath; //导入依赖的package包/类
@Override
public StringPath getPrimaryKey() {
    return qInstance.id;
}
 
开发者ID:FraunhoferIOSB,项目名称:SensorThingsServer,代码行数:5,代码来源:PropertyHelper.java


注:本文中的com.querydsl.core.types.dsl.StringPath类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。