本文整理汇总了Java中org.springframework.data.repository.query.parser.Part.Type类的典型用法代码示例。如果您正苦于以下问题:Java Type类的具体用法?Java Type怎么用?Java Type使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Type类属于org.springframework.data.repository.query.parser.Part包,在下文中一共展示了Type类的18个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: fromInequalityVariant
import org.springframework.data.repository.query.parser.Part.Type; //导入依赖的package包/类
private Predicate<?> fromInequalityVariant(Type type, boolean ignoreCase, Iterator<Comparable<?>> iterator) {
if (ignoreCase && type != Type.SIMPLE_PROPERTY) {
throw new InvalidDataAccessApiUsageException(String.format("Ignore case not supported for '%s'", type));
}
switch (type) {
case GREATER_THAN:
return GreaterLessPredicate.gr(iterator.next());
case GREATER_THAN_EQUAL:
return GreaterLessPredicate.ge(iterator.next());
case LESS_THAN:
return GreaterLessPredicate.ls(iterator.next());
case LESS_THAN_EQUAL:
return GreaterLessPredicate.le(iterator.next());
default:
throw new InvalidDataAccessApiUsageException(String.format("Logic error for '%s' in query", type));
}
}
开发者ID:mrfrag,项目名称:spring-data-mapdb,代码行数:22,代码来源:QueryCreator.java
示例2: getLikeTypeFrom
import org.springframework.data.repository.query.parser.Part.Type; //导入依赖的package包/类
/**
* Extracts the like {@link Type} from the given JPA like expression.
*
* @param expression must not be {@literal null} or empty.
* @return
*/
private static Type getLikeTypeFrom(String expression) {
Assert.hasText(expression, "Expression must not be null or empty!");
if (expression.matches("%.*%")) {
return Type.CONTAINING;
}
if (expression.startsWith("%")) {
return Type.ENDING_WITH;
}
if (expression.endsWith("%")) {
return Type.STARTING_WITH;
}
return Type.LIKE;
}
开发者ID:hexagonframework,项目名称:spring-data-ebean,代码行数:25,代码来源:StringQuery.java
示例3: fromInequalityVariant
import org.springframework.data.repository.query.parser.Part.Type; //导入依赖的package包/类
private Predicate<?, ?> fromInequalityVariant(Type type, boolean ignoreCase, String property,
Iterator<Comparable<?>> iterator) {
if (ignoreCase && type != Type.SIMPLE_PROPERTY) {
throw new InvalidDataAccessApiUsageException(String.format("Ignore case not supported for '%s'", type));
}
switch (type) {
case GREATER_THAN:
return Predicates.greaterThan(property, iterator.next());
case GREATER_THAN_EQUAL:
return Predicates.greaterEqual(property, iterator.next());
case LESS_THAN:
return Predicates.lessThan(property, iterator.next());
case LESS_THAN_EQUAL:
return Predicates.lessEqual(property, iterator.next());
default:
throw new InvalidDataAccessApiUsageException(String.format("Logic error for '%s' in query", type));
}
}
开发者ID:hazelcast,项目名称:spring-data-hazelcast,代码行数:23,代码来源:HazelcastQueryCreator.java
示例4: fromEqualityVariant
import org.springframework.data.repository.query.parser.Part.Type; //导入依赖的package包/类
private Predicate<?, ?> fromEqualityVariant(Type type, boolean ignoreCase, String property,
Iterator<Comparable<?>> iterator) {
switch (type) {
case SIMPLE_PROPERTY:
if (ignoreCase) {
return Predicates.ilike(property, iterator.next().toString());
} else {
return Predicates.equal(property, iterator.next());
}
default:
throw new InvalidDataAccessApiUsageException(String.format("Logic error for '%s' in query", type));
}
}
开发者ID:hazelcast,项目名称:spring-data-hazelcast,代码行数:17,代码来源:HazelcastQueryCreator.java
示例5: getParts
import org.springframework.data.repository.query.parser.Part.Type; //导入依赖的package包/类
/**
* Returns all {@link GqPart}s of the {@link GqPartTree} of the given {@link Type}.
*
* @param type
* @return
*/
public Iterable<GqPart> getParts(Type type) {
List<GqPart> result = new ArrayList<GqPart>();
for (GqPart part : getParts()) {
if (part.getType().equals(type)) {
result.add(part);
}
}
return result;
}
开发者ID:GeeQuery,项目名称:ef-orm,代码行数:19,代码来源:GqPartTree.java
示例6: fromBooleanVariant
import org.springframework.data.repository.query.parser.Part.Type; //导入依赖的package包/类
private Predicate<?, ?> fromBooleanVariant(Type type, String property) {
switch (type) {
case TRUE:
return Predicates.equal(property, true);
case FALSE:
return Predicates.equal(property, false);
default:
throw new InvalidDataAccessApiUsageException(String.format("Logic error for '%s' in query", type));
}
}
开发者ID:hazelcast,项目名称:spring-data-hazelcast,代码行数:14,代码来源:HazelcastQueryCreator.java
示例7: fromLikeVariant
import org.springframework.data.repository.query.parser.Part.Type; //导入依赖的package包/类
private Predicate<?, ?> fromLikeVariant(Type type, String property, Iterator<Comparable<?>> iterator) {
switch (type) {
case LIKE:
return Predicates.like(property, iterator.next().toString());
default:
throw new InvalidDataAccessApiUsageException(String.format("Logic error for '%s' in query", type));
}
}
开发者ID:hazelcast,项目名称:spring-data-hazelcast,代码行数:12,代码来源:HazelcastQueryCreator.java
示例8: fromNullVariant
import org.springframework.data.repository.query.parser.Part.Type; //导入依赖的package包/类
private Predicate<?, ?> fromNullVariant(Type type, String property) {
switch (type) {
case IS_NULL:
return Predicates.equal(property, null);
case IS_NOT_NULL:
return Predicates.notEqual(property, null);
default:
throw new InvalidDataAccessApiUsageException(String.format("Logic error for '%s' in query", type));
}
}
开发者ID:hazelcast,项目名称:spring-data-hazelcast,代码行数:14,代码来源:HazelcastQueryCreator.java
示例9: from
import org.springframework.data.repository.query.parser.Part.Type; //导入依赖的package包/类
private Predicate<?> from(Part part, Iterator<Comparable<?>> iterator) {
String property = part.getProperty().toDotPath();
Type type = part.getType();
boolean ignoreCase = (part.shouldIgnoreCase() != IgnoreCaseType.NEVER);
Predicate<?> predicate = null;
switch (type) {
case TRUE:
predicate = new EqualsPredicate(true);
break;
case FALSE:
predicate = new EqualsPredicate(false);
break;
case SIMPLE_PROPERTY:
if (ignoreCase) {
predicate = new ILikePredicate(iterator.next().toString());
} else {
predicate = new EqualsPredicate(iterator.next());
}
break;
case GREATER_THAN:
case GREATER_THAN_EQUAL:
case LESS_THAN:
case LESS_THAN_EQUAL:
predicate = fromInequalityVariant(type, ignoreCase, iterator);
break;
case LIKE:
predicate = new LikePredicate(iterator.next().toString());
break;
case IS_NULL:
predicate = NullCheckPredicate.isNull();
break;
case IS_NOT_NULL:
predicate = NullCheckPredicate.notNull();
break;
// TODO
/*
* case AFTER: case BEFORE: case BETWEEN: case CONTAINING: case
* ENDING_WITH: case EXISTS: case IN: case NEAR: case
* NEGATING_SIMPLE_PROPERTY: case NOT_CONTAINING: case NOT_IN: case
* NOT_LIKE: case REGEX: case STARTING_WITH: case WITHIN:
*/
default:
throw new InvalidDataAccessApiUsageException(String.format("Found invalid part '%s' in query", type));
}
return PropertyPredicate.wrap(predicate, property);
}
开发者ID:mrfrag,项目名称:spring-data-mapdb,代码行数:60,代码来源:QueryCreator.java
示例10: buildConditionCaluse
import org.springframework.data.repository.query.parser.Part.Type; //导入依赖的package包/类
public String buildConditionCaluse(Type type, IgnoreCaseType ignoreCaseType, String[] properties) {
StringBuilder builder = new StringBuilder();
switch (type) {
case CONTAINING:
case NOT_CONTAINING:
if (ignoreCaseType == ALWAYS || ignoreCaseType == WHEN_POSSIBLE) {
builder.append("concat('%',upper(#{" + properties[0] + "}),'%')");
} else {
builder.append("concat('%',#{" + properties[0] + "},'%')");
}
break;
case STARTING_WITH:
if (ignoreCaseType == ALWAYS || ignoreCaseType == WHEN_POSSIBLE) {
builder.append("concat(upper(#{" + properties[0] + "}),'%')");
} else {
builder.append("concat(#{" + properties[0] + "},'%')");
}
break;
case ENDING_WITH:
if (ignoreCaseType == ALWAYS || ignoreCaseType == WHEN_POSSIBLE) {
builder.append("concat('%',upper(#{" + properties[0] + "}))");
} else {
builder.append("concat('%',#{" + properties[0] + "})");
}
break;
case IN:
case NOT_IN:
builder.append("<foreach item=\"item\" index=\"index\" collection=\"" + properties[0] + "\" open=\"(\" separator=\",\" close=\")\">#{item}</foreach>");
break;
case IS_NOT_NULL:
builder.append(" is not null");
break;
case IS_NULL:
builder.append(" is null");
break;
case TRUE:
builder.append("=true");
break;
case FALSE:
builder.append("=false");
break;
default:
if (ignoreCaseType == ALWAYS || ignoreCaseType == WHEN_POSSIBLE) {
builder.append("upper(#{" + properties[0] + "})");
} else {
builder.append("#{" + properties[0] + "}");
}
break;
}
return builder.toString();
}
开发者ID:hatunet,项目名称:spring-data-mybatis,代码行数:55,代码来源:MybatisMapperGenerator.java
示例11: buildConditionOperate
import org.springframework.data.repository.query.parser.Part.Type; //导入依赖的package包/类
public String buildConditionOperate(Type type) {
StringBuilder builder = new StringBuilder();
switch (type) {
case SIMPLE_PROPERTY:
builder.append("=");
break;
case NEGATING_SIMPLE_PROPERTY:
builder.append("<![CDATA[<>]]>");
break;
case LESS_THAN:
case BEFORE:
builder.append("<![CDATA[<]]>");
break;
case LESS_THAN_EQUAL:
builder.append("<![CDATA[<=]]>");
break;
case GREATER_THAN:
case AFTER:
builder.append("<![CDATA[>]]>");
break;
case GREATER_THAN_EQUAL:
builder.append("<![CDATA[>=]]>");
break;
case LIKE:
case NOT_LIKE:
case STARTING_WITH:
case ENDING_WITH:
if (type == NOT_LIKE) {
builder.append(" not");
}
builder.append(" like ");
break;
case CONTAINING:
case NOT_CONTAINING:
if (type == NOT_CONTAINING) {
builder.append(" not");
}
builder.append(" like ");
break;
case IN:
case NOT_IN:
if (type == NOT_IN) {
builder.append(" not");
}
builder.append(" in ");
break;
}
return builder.toString();
}
开发者ID:hatunet,项目名称:spring-data-mybatis,代码行数:52,代码来源:MybatisMapperGenerator.java
示例12: from
import org.springframework.data.repository.query.parser.Part.Type; //导入依赖的package包/类
private Criteria from(Type type, Criteria instance, Iterator<?> parameters) {
Criteria criteria = instance;
if (criteria == null) {
criteria = new Criteria();
}
switch (type) {
case TRUE:
return criteria.is(true);
case FALSE:
return criteria.is(false);
case SIMPLE_PROPERTY:
return criteria.is(appendBoostAndGetParameterValue(criteria, parameters));
case NEGATING_SIMPLE_PROPERTY:
return criteria.is(appendBoostAndGetParameterValue(criteria, parameters)).not();
case IS_NULL:
return criteria.isNull();
case IS_NOT_NULL:
return criteria.isNotNull();
case REGEX:
return criteria.expression(appendBoostAndGetParameterValue(criteria, parameters).toString());
case LIKE:
case STARTING_WITH:
return criteria.startsWith(asStringArray(appendBoostAndGetParameterValue(criteria, parameters)));
case NOT_LIKE:
return criteria.startsWith(asStringArray(appendBoostAndGetParameterValue(criteria, parameters))).not();
case ENDING_WITH:
return criteria.endsWith(asStringArray(appendBoostAndGetParameterValue(criteria, parameters)));
case CONTAINING:
return criteria.contains(asStringArray(appendBoostAndGetParameterValue(criteria, parameters)));
case AFTER:
case GREATER_THAN:
return criteria.greaterThan(appendBoostAndGetParameterValue(criteria, parameters));
case GREATER_THAN_EQUAL:
return criteria.greaterThanEqual(appendBoostAndGetParameterValue(criteria, parameters));
case BEFORE:
case LESS_THAN:
return criteria.lessThan(appendBoostAndGetParameterValue(criteria, parameters));
case LESS_THAN_EQUAL:
return criteria.lessThanEqual(appendBoostAndGetParameterValue(criteria, parameters));
case BETWEEN:
return criteria.between(appendBoostAndGetParameterValue(criteria, parameters),
appendBoostAndGetParameterValue(criteria, parameters));
case IN:
return criteria.in(asArray(appendBoostAndGetParameterValue(criteria, parameters)));
case NOT_IN:
return criteria.in(asArray(appendBoostAndGetParameterValue(criteria, parameters))).not();
case NEAR:
return createNearCriteria(parameters, criteria);
case WITHIN:
return criteria.within((Point) getBindableValue((BindableSolrParameter) parameters.next()),
(Distance) getBindableValue((BindableSolrParameter) parameters.next()));
default:
throw new InvalidDataAccessApiUsageException("Illegal criteria found '" + type + "'.");
}
}
开发者ID:yiduwangkai,项目名称:dubbox-solr,代码行数:57,代码来源:SolrQueryCreator.java
示例13: from
import org.springframework.data.repository.query.parser.Part.Type; //导入依赖的package包/类
private Predicate<?, ?> from(Part part, Iterator<Comparable<?>> iterator) {
String property = part.getProperty().toDotPath();
Type type = part.getType();
boolean ignoreCase = (part.shouldIgnoreCase() != IgnoreCaseType.NEVER);
switch (type) {
case FALSE:
case TRUE:
return fromBooleanVariant(type, property);
case SIMPLE_PROPERTY:
return fromEqualityVariant(type, ignoreCase, property, iterator);
case GREATER_THAN:
case GREATER_THAN_EQUAL:
case LESS_THAN:
case LESS_THAN_EQUAL:
return fromInequalityVariant(type, ignoreCase, property, iterator);
case LIKE:
return fromLikeVariant(type, property, iterator);
case IS_NOT_NULL:
case IS_NULL:
return fromNullVariant(type, property);
/* case AFTER:
* case BEFORE:
* case BETWEEN:
* case CONTAINING:
* case ENDING_WITH:
* case EXISTS:
* case IN:
* case NEAR:
* case NEGATING_SIMPLE_PROPERTY:
* case NOT_CONTAINING:
* case NOT_IN:
* case NOT_LIKE:
* case REGEX:
* case STARTING_WITH:
* case WITHIN:
*/
default:
throw new InvalidDataAccessApiUsageException(String.format("Found invalid part '%s' in query", type));
}
}
开发者ID:hazelcast,项目名称:spring-data-hazelcast,代码行数:50,代码来源:HazelcastQueryCreator.java
示例14: requiresInverseLookup
import org.springframework.data.repository.query.parser.Part.Type; //导入依赖的package包/类
private static boolean requiresInverseLookup(Part part) {
return part.getType() == Type.IN;
}
开发者ID:spring-projects,项目名称:spring-data-keyvalue,代码行数:4,代码来源:SpelQueryCreator.java
示例15: ParameterMetadata
import org.springframework.data.repository.query.parser.Part.Type; //导入依赖的package包/类
/**
* Creates a new {@link ParameterMetadata}.
*
* @param parameterType
* @param parameterName
* @param type
* @param value
*/
public ParameterMetadata(Class<T> parameterType, String parameterName, Type type, Object value) {
this.parameterType = parameterType;
this.parameterName = parameterName;
this.parameterValue = value;
this.type = (value == null && Type.SIMPLE_PROPERTY.equals(type) ? Type.IS_NULL : type);
}
开发者ID:hexagonframework,项目名称:spring-data-ebean,代码行数:15,代码来源:ParameterMetadataProvider.java
示例16: LikeParameterBinding
import org.springframework.data.repository.query.parser.Part.Type; //导入依赖的package包/类
/**
* Creates a new {@link LikeParameterBinding} for the parameter with the given name and {@link Type} and parameter
* binding input.
*
* @param name must not be {@literal null} or empty.
* @param type must not be {@literal null}.
* @param expression may be {@literal null}.
*/
public LikeParameterBinding(String name, Type type, String expression) {
super(name, null, expression);
Assert.hasText(name, "Name must not be null or empty!");
Assert.notNull(type, "Type must not be null!");
Assert.isTrue(SUPPORTED_TYPES.contains(type),
String.format("Type must be one of %s!", StringUtils.collectionToCommaDelimitedString(SUPPORTED_TYPES)));
this.type = type;
}
开发者ID:hexagonframework,项目名称:spring-data-ebean,代码行数:21,代码来源:StringQuery.java
示例17: isIsNullParameter
import org.springframework.data.repository.query.parser.Part.Type; //导入依赖的package包/类
/**
* Returns whether the parameter shall be considered an {@literal IS NULL} parameter.
*
* @return
*/
public boolean isIsNullParameter() {
return Type.IS_NULL.equals(type);
}
开发者ID:hexagonframework,项目名称:spring-data-ebean,代码行数:9,代码来源:ParameterMetadataProvider.java
示例18: getType
import org.springframework.data.repository.query.parser.Part.Type; //导入依赖的package包/类
/**
* Returns the {@link Type} of the binding.
*
* @return the type
*/
public Type getType() {
return type;
}
开发者ID:hexagonframework,项目名称:spring-data-ebean,代码行数:9,代码来源:StringQuery.java
注:本文中的org.springframework.data.repository.query.parser.Part.Type类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论