List of usage examples for java.lang Object toString
public String toString()
From source file:Main.java
public static boolean isObjectNotEmpty(Object obj) { if (null != obj && !"".equals(obj.toString()) && !"null".equals(obj.toString().toLowerCase())) { return true; } else {// w w w . j a va2s . c om return false; } }
From source file:Main.java
/** * Converts a collection of objects into a collection of strings by calling toString on each object. * @param items the objects to convert/*w w w. java 2 s. c o m*/ * @return A collection of strings */ public static Collection<String> convertToStrings(Iterable<?> items) { Iterable<String> codes = Iterables.transform(items, new Function<Object, String>() { public String apply(Object item) { return item.toString(); } }); return Lists.newArrayList(codes); }
From source file:Main.java
public static boolean isEmpty(Object str) { return str == null || str.toString().length() == 0; }
From source file:Main.java
/** * Gets an element in its String representation * * @param obj The object to be transformed * @return The String representation/*from w w w . j a va2 s . c om*/ */ public static String valueOf(Object obj) { return (obj == null) ? "null" : obj.toString(); }
From source file:Main.java
public static long doLong(Object obj) { return obj != null ? Long.parseLong(obj.toString()) : 0; }
From source file:Main.java
public static boolean match(Object src, Object pattern) { if (src == null || src.toString().trim().isEmpty()) { return false; }//from w w w . ja v a 2 s . c om return src.toString().matches(pattern.toString()); }
From source file:Main.java
public static byte doByte(Object obj) { return obj != null ? Byte.parseByte(obj.toString()) : 0; }
From source file:Main.java
public static String safeToString(Object o) { return o == null ? "null" : o.toString(); }
From source file:Main.java
public static String convertListToURLParamsString(List<?> values) { StringBuffer buff = new StringBuffer(); for (Object object : values) { buff.append(object.toString() + "&"); }/*from w w w . j av a2 s.c o m*/ buff.replace(buff.length() - 1, buff.length(), ""); return buff.toString(); }
From source file:Main.java
public static short doShort(Object obj) { return obj != null ? Short.parseShort(obj.toString()) : 0; }