src/main/java/tinyrtpl/Data.java
private static String stringOf(Object obj, int type) {
        if(obj == null || type == 0) return "";
        String str;
        switch (type) {
            case 1:
                str = Boolean.toString((Boolean) obj);
                break;
            case 2:
                str = Integer.toString((Integer) obj);
                break;
            case 3:
                double d;
                if (obj instanceof Float) {
                    BigDecimal b = new BigDecimal(String.valueOf((Float) obj));
                    d = b.doubleValue();
                } else {
                    d = (Double) obj;
                }
                str = Double.toString(d);
                break;
            case 4:
                str = (String) obj;
                break;
            case 5:
                str = "map";
                break;
            case 6:
                str = "array";
                break;
            default:
                str = "";
        }
        return str;
    }
/**
     * Return the string format of a given Object.
     * @param obj: a type-specific Object
     * @param type: type pf the Object
     * @return string of the Object
     */
Return the string format of a given Object.
@param obj: a type-specific Object
@param type: type pf the Object
@return string of the Object
Return the string format of a given Object . @param obj : a type - specific Object @param type : type pf the Object @return string of the Object
private static String stringOf(Object obj, int type) {
        if(obj == null || type == 0) return "";
        String str;
        switch (type) {
            case 1:
                str = Boolean.toString((Boolean) obj);
                break;
            case 2:
                str = Integer.toString((Integer) obj);
                break;
            case 3:
                double d;
                if (obj instanceof Float) {
                    BigDecimal b = new BigDecimal(String.valueOf((Float) obj));
                    d = b.doubleValue();
                } else {
                    d = (Double) obj;
                }
                str = Double.toString(d);
                break;
            case 4:
                str = (String) obj;
                break;
            case 5:
                str = "map";
                break;
            case 6:
                str = "array";
                break;
            default:
                str = "";
        }
        return str;
    }
private static String stringOf ( Object obj , int type ) { if ( obj == null || type == 0 ) return "" ; String str ; switch ( type ) { case 1 : str = Boolean . toString ( ( Boolean ) obj ) ; break ; case 2 : str = Integer . toString ( ( Integer ) obj ) ; break ; case 3 : double d ; if ( obj instanceof Float ) { BigDecimal b = new BigDecimal ( String . valueOf ( ( Float ) obj ) ) ; d = b . doubleValue ( ) ; } else { d = ( Double ) obj ; } str = Double . toString ( d ) ; break ; case 4 : str = ( String ) obj ; break ; case 5 : str = "map" ; break ; case 6 : str = "array" ; break ; default : str = "" ; } return str ; }
Return the string format of a given Object.
Return the string format of a given Object .