List of usage examples for java.lang Object toString
public String toString()
From source file:com.proctorcam.proctorserv.HashedAuthenticator.java
protected static String arrayQuery(Object key, Object[] array) { StringBuilder query = new StringBuilder(); for (Object s : array) { String arrayValue = s.toString(); query.append(String.format("%s[]=%s&", key, arrayValue)); }//w ww . j a v a 2 s . c o m return query.toString(); }
From source file:Main.java
public static float asFloat(Object value, float def) { if (value instanceof Number) { return ((Number) value).floatValue(); } else {//from w ww . ja va 2 s . c o m try { return Float.valueOf(value.toString()); } catch (NumberFormatException ex) { return def; } } }
From source file:Main.java
public static final long objectToLong(Object o) { if (o instanceof Number) return ((Number) o).longValue(); try {/*from w ww . jav a 2 s. c o m*/ if (o == null) return -1L; else return Long.parseLong(o.toString()); } catch (NumberFormatException e) { e.printStackTrace(); return -1L; } }
From source file:Main.java
public static final short objectToShort(Object o) { if (o instanceof Number) return ((Number) o).shortValue(); try {//from w w w . jav a 2s . c om if (o == null) return -1; else return Short.parseShort(o.toString()); } catch (NumberFormatException e) { return -1; } }
From source file:nl.frankkie.bronylivewallpaper.CLog.java
public static void e(Object msg) { e(TAG, msg.toString()); }
From source file:nl.frankkie.bronylivewallpaper.CLog.java
public static void d(Object msg) { d(TAG, msg.toString()); }
From source file:nl.frankkie.bronylivewallpaper.CLog.java
public static void i(Object msg) { i(TAG, msg.toString()); }
From source file:nl.frankkie.bronylivewallpaper.CLog.java
public static void v(Object msg) { v(TAG, msg.toString()); }
From source file:nl.frankkie.bronylivewallpaper.CLog.java
public static void w(Object msg) { w(TAG, msg.toString()); }
From source file:com.vk.sdk.util.VKJsonHelper.java
/** * Converts object to JSON object, if possible * * @param object object to serialize to json * @return Completed json object/* www. j a v a 2s. co m*/ * @throws JSONException */ public static Object toJSON(Object object) throws JSONException { if (object instanceof Map) { JSONObject json = new JSONObject(); Map map = (Map) object; for (Object key : map.keySet()) { json.put(key.toString(), toJSON(map.get(key))); } return json; } else if (object instanceof Iterable) { JSONArray json = new JSONArray(); for (Object value : ((Iterable) object)) { json.put(value); } return json; } else { return object; } }