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


Java NumberPath.goe方法代码示例

本文整理汇总了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);
}
 
开发者ID:gvSIGAssociation,项目名称:gvnix1,代码行数:76,代码来源:QuerydslUtils.java

示例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);
}
 
开发者ID:gvSIGAssociation,项目名称:gvnix1,代码行数:67,代码来源:QuerydslUtilsBeanImpl.java


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