List of usage examples for java.lang Object toString
public String toString()
From source file:Main.java
public static int obj2Int(Object obj) { if (obj == null) return 0; return str2Int(obj.toString(), 0); }
From source file:Main.java
public static Integer TryParse(Object obj) { Integer retVal;/*from ww w . j av a 2s . c o m*/ try { retVal = Integer.parseInt(obj.toString()); } catch (NumberFormatException nfe) { retVal = null; // or null if that is your preference } return retVal; }
From source file:Main.java
/** * null Object to empty string//w w w .j av a2 s .c o m * * <pre> * nullStrToEmpty(null) = ""; * nullStrToEmpty("") = ""; * nullStrToEmpty("aa") = "aa"; * </pre> * * @param str * @return */ public static String nullStrToEmpty(Object str) { return (str == null ? "" : (str instanceof String ? (String) str : str.toString())); }
From source file:Main.java
public static boolean decimal(Object o) { double n = 0; try {// www . ja v a2 s . c om n = Double.parseDouble(o.toString().trim()); } catch (NumberFormatException e) { e.printStackTrace(); } if (n > 0.0) { return true; } else { return false; } }
From source file:Main.java
public static int convert2Int(Object value, int defaultValue) { if (value == null || "".equals(value.toString().trim())) { return defaultValue; }/* w ww . j a v a2 s .c o m*/ try { return Double.valueOf(value.toString()).intValue(); } catch (Exception e) { e.printStackTrace(); return defaultValue; } }
From source file:Main.java
public static long obj2Long(Object obj) { if (obj == null) return 0L; return str2Long(obj.toString(), 0L); }
From source file:com.example.client.TravelBookingClient.java
private static final void log(Object message) { System.out.println(message.toString()); }
From source file:Main.java
public static String nvl(Object obj, String def) { return obj == null || obj.equals("null") || obj.equals("") ? def : obj.toString(); }
From source file:Debug.java
/** * Static method to println an arbitrary Objecct if the given category is * enabled for debugging, as reported by isEnabled. *///w w w . ja v a 2 s . c om public static void println(String category, Object stuff) { println(category, stuff.toString()); }
From source file:Main.java
public static <T> Set<String> toStringSet(Collection<T> a_values) /* */ {//from w w w .j a v a 2 s .com /* 443 */Set values = new HashSet(); /* */ /* 445 */for (Iterator i$ = a_values.iterator(); i$.hasNext();) { Object value = i$.next(); /* */ /* 447 */values.add(value.toString()); /* */} /* */ /* 450 */return values; /* */}