Package com.addthis.bundle.value

Examples of com.addthis.bundle.value.Numeric


    /**
     * return number if it's already one.  if not guess double or
     * long based on the presence of "." in string version and parse.
     */
    public static Numeric asNumberOrParse(ValueObject v) {
        Numeric n = asNumber(v);
        if (n == null && v != null) {
            String sv = v.toString();
            if (sv.indexOf(".") > 0) {
                return ValueFactory.create(Double.parseDouble(v.toString()));
            } else {
View Full Code Here


    /**
     * return number if it's already one.  if not parse as long from
     * the string value using provided radix.
     */
    public static Numeric asNumberOrParseLong(ValueObject v, int radix) {
        Numeric n = asNumber(v);
        if (n == null && v != null) {
            return ValueFactory.create(Long.parseLong(v.toString(), radix));
        }
        return n;
    }
View Full Code Here

    /**
     * return number if it's already one.  if not parse as double from
     * the string value.
     */
    public static Numeric asNumberOrParseDouble(ValueObject v) {
        Numeric n = asNumber(v);
        if (n == null && v != null) {
            return ValueFactory.create(Double.parseDouble(v.toString()));
        }
        return n;
    }
View Full Code Here

TOP

Related Classes of com.addthis.bundle.value.Numeric

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.