本文整理汇总了Java中com.mysema.query.types.path.NumberPath.goe方法的典型用法代码示例。如果您正苦于以下问题:Java NumberPath.goe方法的具体用法?Java NumberPath.goe怎么用?Java NumberPath.goe使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.mysema.query.types.path.NumberPath
的用法示例。
在下文中一共展示了NumberPath.goe方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createNumericExpression
import com.mysema.query.types.path.NumberPath; //导入方法依赖的package包/类
/**
* Return an expression for {@code entityPath.fieldName} (for Numerics) with
* the {@code operator} or "equal" by default.
* <p/>
* Expr: {@code entityPath.fieldName eq searchObj}
*
* @param entityPath
* @param fieldName
* @param searchObj
* @param operator
* @param fieldType
* @return
*/
@SuppressWarnings({ "rawtypes", "unchecked" })
public static <T> BooleanExpression createNumericExpression(
PathBuilder<T> entityPath, String fieldName, Object searchObj,
String operator, Class<?> fieldType) {
NumberPath numberExpression = null;
if (BigDecimal.class.isAssignableFrom(fieldType)) {
numberExpression = entityPath.getNumber(fieldName,
(Class<BigDecimal>) fieldType);
}
else if (BigInteger.class.isAssignableFrom(fieldType)) {
numberExpression = entityPath.getNumber(fieldName,
(Class<BigInteger>) fieldType);
}
else if (Byte.class.isAssignableFrom(fieldType)) {
numberExpression = entityPath.getNumber(fieldName,
(Class<Byte>) fieldType);
}
else if (Double.class.isAssignableFrom(fieldType)
|| double.class == fieldType) {
numberExpression = entityPath.getNumber(fieldName,
(Class<Double>) fieldType);
}
else if (Float.class.isAssignableFrom(fieldType)
|| float.class == fieldType) {
numberExpression = entityPath.getNumber(fieldName,
(Class<Float>) fieldType);
}
else if (Integer.class.isAssignableFrom(fieldType)
|| int.class == fieldType) {
numberExpression = entityPath.getNumber(fieldName,
(Class<Integer>) fieldType);
}
else if (Long.class.isAssignableFrom(fieldType)
|| long.class == fieldType) {
numberExpression = entityPath.getNumber(fieldName,
(Class<Long>) fieldType);
}
else if (Short.class.isAssignableFrom(fieldType)
|| short.class == fieldType) {
numberExpression = entityPath.getNumber(fieldName,
(Class<Short>) fieldType);
}
if (numberExpression != null) {
Number value = NumberUtils.createNumber((String) searchObj);
if (StringUtils.equalsIgnoreCase(operator, OPERATOR_GOE)) {
return numberExpression.goe(value);
}
else if (StringUtils.equalsIgnoreCase(operator, "gt")) {
return numberExpression.gt(value);
}
else if (StringUtils.equalsIgnoreCase(operator, "like")) {
return numberExpression.like((String) searchObj);
}
else if (StringUtils.equalsIgnoreCase(operator, OPERATOR_LOE)) {
return numberExpression.loe(value);
}
else if (StringUtils.equalsIgnoreCase(operator, "lt")) {
return numberExpression.lt(value);
}
}
return entityPath.get(fieldName).eq(searchObj);
}
示例2: createNumericExpression
import com.mysema.query.types.path.NumberPath; //导入方法依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
@SuppressWarnings({ "rawtypes", "unchecked" })
public <T> BooleanExpression createNumericExpression(
PathBuilder<T> entityPath, String fieldName, Object searchObj,
String operator, Class<?> fieldType) {
NumberPath numberExpression = null;
if (BigDecimal.class.isAssignableFrom(fieldType)) {
numberExpression = entityPath.getNumber(fieldName,
(Class<BigDecimal>) fieldType);
}
else if (BigInteger.class.isAssignableFrom(fieldType)) {
numberExpression = entityPath.getNumber(fieldName,
(Class<BigInteger>) fieldType);
}
else if (Byte.class.isAssignableFrom(fieldType)) {
numberExpression = entityPath.getNumber(fieldName,
(Class<Byte>) fieldType);
}
else if (Double.class.isAssignableFrom(fieldType)
|| double.class == fieldType) {
numberExpression = entityPath.getNumber(fieldName,
(Class<Double>) fieldType);
}
else if (Float.class.isAssignableFrom(fieldType)
|| float.class == fieldType) {
numberExpression = entityPath.getNumber(fieldName,
(Class<Float>) fieldType);
}
else if (Integer.class.isAssignableFrom(fieldType)
|| int.class == fieldType) {
numberExpression = entityPath.getNumber(fieldName,
(Class<Integer>) fieldType);
}
else if (Long.class.isAssignableFrom(fieldType)
|| long.class == fieldType) {
numberExpression = entityPath.getNumber(fieldName,
(Class<Long>) fieldType);
}
else if (Short.class.isAssignableFrom(fieldType)
|| short.class == fieldType) {
numberExpression = entityPath.getNumber(fieldName,
(Class<Short>) fieldType);
}
if (numberExpression != null) {
Number value = NumberUtils.createNumber((String) searchObj);
if (StringUtils.equalsIgnoreCase(operator, OPERATOR_GOE)) {
return numberExpression.goe(value);
}
else if (StringUtils.equalsIgnoreCase(operator, "gt")) {
return numberExpression.gt(value);
}
else if (StringUtils.equalsIgnoreCase(operator, "like")) {
return numberExpression.like((String) searchObj);
}
else if (StringUtils.equalsIgnoreCase(operator, OPERATOR_LOE)) {
return numberExpression.loe(value);
}
else if (StringUtils.equalsIgnoreCase(operator, "lt")) {
return numberExpression.lt(value);
}
}
return entityPath.get(fieldName).eq(searchObj);
}