List of usage examples for java.lang Object toString
public String toString()
From source file:org.craftercms.social.migration.util.scripting.ScriptUtils.java
public static NativeObject toJSObject(Map map) { final NativeObject toReturn = new NativeObject(); for (Object key : map.keySet()) { toReturn.defineProperty(key.toString(), map.get(key), NativeObject.READONLY); }/*from w w w . j a v a 2s.c o m*/ return toReturn; }
From source file:Main.java
public static String join(final Collection<?> arr, final String sep) { final StringBuilder s = new StringBuilder(); for (final Object obj : arr) { if (s.length() > 0) s.append(sep);//from w w w . ja v a2 s . co m s.append(obj.toString()); } return s.toString(); }
From source file:Main.java
/** * Returns a string containing the tokens joined by delimiters, * taking in considerations if the token of the iterable is null * * @param tokens an array objects to be joined. Strings will be formed from * the objects by calling object.toString(). */// ww w . j av a 2s. c om public static String join(CharSequence delimiter, Iterable tokens) { StringBuilder sb = new StringBuilder(); boolean firstTime = true; for (Object token : tokens) { if (token == null || isEmpty(token.toString())) { continue; } if (firstTime) { firstTime = false; } else { sb.append(delimiter); } sb.append(token.toString()); } //all the tokens where null if (firstTime) { return null; } return sb.toString(); }
From source file:com.googlecode.jtiger.modules.ecside.common.HTMLOptionsUtil.java
public static String convertString(Object obj, String nullTo) { return obj == null ? nullTo : obj.toString(); }
From source file:Main.java
public static void printExtras(Intent i) { if (i == null) { return;/* ww w .ja v a 2s . com*/ } Bundle bundle = i.getExtras(); if (bundle == null) { return; } Log.d("INTENT_EXTRAS", "++++ Printing extras: +++"); for (String key : bundle.keySet()) { Object value = bundle.get(key); Log.d("INTENT_EXTRAS", String.format("%s %s (%s)", key, value.toString(), value.getClass().getName())); } }
From source file:com.chadekin.jadys.commons.expression.SqlExpressionBuilder.java
public static boolean isBlankValue(Object value) { boolean isBlank = value == null || StringUtils.isBlank(value.toString()); if (!isBlank) { boolean isEmptyCollection = value instanceof Collection && CollectionUtils.isEmpty((Collection) value); boolean isEmptyArray = value.getClass().isArray() && Array.getLength(value) == 0; isBlank = isEmptyCollection || isEmptyArray; }//from w w w. ja v a2s . co m return isBlank; }
From source file:com.surfs.storage.web.utils.WebUtils.java
public static String getCrrentDataCenterKey(HttpSession session) { /*return "uspod1/uscluster2";*/ Object dataCenterKey = session.getAttribute("dataCenterKey"); return dataCenterKey != null ? dataCenterKey.toString() : null; }
From source file:cn.wanghaomiao.seimi.utils.StrFormatUtil.java
public static String info(String pattern, Object... params) { for (Object p : params) { pattern = StringUtils.replaceOnce(pattern, "{}", p.toString()); }/* ww w . j a v a2 s.c om*/ return pattern; }
From source file:Main.java
public static long getAsInteger(final ContentValues values, final String key, final int def) { if (values == null || key == null) return def; final Object value = values.get(key); if (value == null) return def; return Integer.valueOf(value.toString()); }
From source file:Main.java
public static boolean getAsBoolean(final ContentValues values, final String key, final boolean def) { if (values == null || key == null) return def; final Object value = values.get(key); if (value == null) return def; return Boolean.valueOf(value.toString()); }