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 boolean isEmpty(Object o) {
    return o == null || (o instanceof String && o.toString().trim().equals(""));
}

From source file:Main.java

public static float doFloat(Object obj) {
    return obj != null ? Float.parseFloat(obj.toString()) : 0;
}

From source file:Main.java

public static int doInt(Object obj) {
    return obj != null ? Integer.parseInt(obj.toString()) : 0;
}

From source file:Main.java

public static String doString(Object obj, String defValue) {
    return obj != null ? obj.toString() : defValue;
}

From source file:Main.java

public static String nvl(Object obj, String def) {
    return obj == null ? def : obj.toString();
}

From source file:Main.java

public static double doDouble(Object obj) {
    return obj != null ? Double.parseDouble(obj.toString()) : 0;
}

From source file:Main.java

public static boolean isNullOrEmpty(final Object str) {
    return (str == null || str.toString().length() == 0);
}

From source file:Main.java

public static boolean doBoolean(Object obj) {
    return obj != null ? Boolean.parseBoolean(obj.toString()) : false;
}

From source file:Main.java

public static String nvl(Object obj) {
    return obj == null ? "" : (("null").equals(obj.toString()) == true ? "" : obj.toString());
}

From source file:Main.java

public static void log(Object o) {
    try {//from  w w  w.j a  v a  2s  .  c  o m
        Log.d("MGX", o.toString());
    } catch (Exception e) {
        Log.e("MGX", "ERROR LOGGING");
    }
}