Example usage for java.lang Object toString

List of usage examples for java.lang Object toString

Introduction

In this page you can find the example usage for java.lang Object toString.

Prototype

public String toString() 

Source Link

Document

Returns a string representation of the object.

Usage

From source file:Main.java

public static void e(Object o) {
    try {//www  .ja v  a2 s. c  o  m
        Log.e("MGX", o.toString());
    } catch (Exception e) {
        Log.e("MGX", "ERROR LOGGING");
    }
}

From source file:Main.java

private static String parseString(final Object object) {
    return object != null ? object.toString() : null;
}

From source file:Main.java

public static String NullToString(Object text) {
    if (text != null) {
        return text.toString();
    } else {//from   w  w  w .ja v  a 2  s . c o m
        return "";
    }
}

From source file:Main.java

public static List<String> toString(final List<? extends Object> list) {
    final List<String> strings = new ArrayList<String>(list.size());
    for (Object o : list)
        strings.add(o.toString());
    return strings;
}

From source file:Main.java

public static String getStrDefaultVal(Object o, String defaultVal) {
    String result = (o != null) ? o.toString() : defaultVal;
    return result;
}

From source file:Main.java

public static boolean isNumeric(Object num) {
    if ((num == null) || (num.toString().length() <= 0)) {
        return false;
    }//from  w ww  . j av a  2 s .  co m
    String str = num.toString();
    if (str.length() <= 0) {
        return false;
    }
    if (str.matches("\\d{1,}")) {
        return true;
    }
    if (str.matches("^((-\\d+)|(0+))$")) {
        return true;
    }

    return (str.matches("^[0-9]+(.[0-9]{1,3})?$"));
}

From source file:Main.java

public static boolean isNotEmpty(Object str) {
    return str != null && !"null".equals(str) && str.toString().trim().length() > 0;
}

From source file:Main.java

public static boolean isEmpty(Object source) {
    return (source == null || source.toString().trim().equals(""));
}

From source file:Main.java

/**
 * <p>//from  w w  w. j a  v  a2s .c  o  m
 * Calculates a 8-byte (64bit) hash from an object by invoking the objects
 * {@link Object#toString()} first and then generating the hash value for
 * the generated string value.
 * </p>
 * 
 * @param object
 *            The object whose key shall be calculated
 * @return The 64bit long hash value for the provided object
 */
public static long hash(final Object object) {
    return hash(object.toString());
}

From source file:Main.java

public static String collectionToStr(Collection<?> collection) {
    if (collection != null) {
        StringBuilder sb = new StringBuilder();
        for (Object obj : collection) {
            sb.append(obj.toString());
        }/*from  w ww. j a va 2s. co m*/
        return sb.toString();
    } else {
        return "";
    }
}