renren-common/src/main/java/io/renren/common/specification/RSQLSpecification.java
/**
     * parse value to the suitable type by path
     * @param path extends Expression
     * @param value is the value that is needed to parse
     * @return value with correct type
     */
parse value to the suitable type by path
@param path extends Expression
@param value is the value that is needed to parse
@return value with correct type
parse value to the suitable type by path @param path extends Expression @param value is the value that is needed to parse @return value with correct type
private <Y> Y parseValue(Path<Y> path, Y value) {
        Class<? extends Y> type = path.getJavaType();
        if (Date.class.isAssignableFrom(type) || LocalDateTime.class.isAssignableFrom(type)) {
            return (Y) LocalDateTime.parse(value.toString(), DateTimeFormatter.ISO_DATE_TIME);
        }
        if (YearMonth.class.isAssignableFrom(type)) {
            return (Y) YearMonth.parse(value.toString());
        }
         parse Enum
        if (Enum.class.isAssignableFrom(type)) {
            return (Y) Enum.valueOf((Class<? extends Enum>) type, value.toString());
        }
         parse Boolean
        if (boolean.class.isAssignableFrom(type) || Boolean.class.isAssignableFrom(type)) {
            return (Y) Boolean.valueOf(value.toString());
        }
        return value;
    }
private < Y > Y parseValue ( Path < Y > path , Y value ) { Class < ? extends Y > type = path . getJavaType ( ) ; if ( Date . class . isAssignableFrom ( type ) || LocalDateTime . class . isAssignableFrom ( type ) ) { return ( Y ) LocalDateTime . parse ( value . toString ( ) , DateTimeFormatter . ISO_DATE_TIME ) ; } if ( YearMonth . class . isAssignableFrom ( type ) ) { return ( Y ) YearMonth . parse ( value . toString ( ) ) ; } if ( Enum . class . isAssignableFrom ( type ) ) { return ( Y ) Enum . valueOf ( ( Class < ? extends Enum > ) type , value . toString ( ) ) ; } if ( boolean . class . isAssignableFrom ( type ) || Boolean . class . isAssignableFrom ( type ) ) { return ( Y ) Boolean . valueOf ( value . toString ( ) ) ; } return value ; }
parse value to the suitable type by path
 @param path extends Expression
 @param value is the value that is needed to parse
 @return value with correct type
parse value to the suitable type by path @param path extends Expression @param value is the value that is needed to parse @return value with correct type
// parse Date // // parse Enum // parse Boolean