List of usage examples for java.lang Object toString
public String toString()
From source file:Main.java
/** * Clones a map and prefixes the keys in the clone, e.g. * for mapping "JAVA_HOME" to "env.JAVA_HOME" to simulate * the behaviour of ANT.//from w w w . ja v a 2s . c o m * * @param source the source map * @param prefix the prefix used for all names * @return the clone of the source map */ public static Map prefix(Map source, String prefix) { if (source == null) { return null; } Map result = new HashMap(); Iterator iter = source.entrySet().iterator(); while (iter.hasNext()) { Map.Entry entry = (Map.Entry) iter.next(); Object key = entry.getKey(); Object value = entry.getValue(); result.put(prefix + '.' + key.toString(), value); } return result; }
From source file:Main.java
private static String objectToString(Object x) { // Extreme compatibility with StringBuilder.append(null) String s;/*www . j a v a 2 s . co m*/ return (x == null || (s = x.toString()) == null) ? "null" : s; }
From source file:com.amazonaws.sns.samples.tools.SampleMessageGenerator.java
public static String jsonify(Object message) { return message.toString(); /*try {/*from w ww. ja va 2 s . c o m*/ return objectMapper.writeValueAsString(message); } catch (Exception e) { e.printStackTrace(); throw (RuntimeException) e; }*/ }
From source file:de.codesourcery.geoip.locate.FreeGeoIPLocator.java
private static String objToString(Object obj) { return obj == null ? "" : obj.toString(); }
From source file:Main.java
public static void xmlProps(final StringBuilder sb, final Properties props) { if (props != null) { int i = 0; for (Object key : props.keySet()) { if (i > 0) sb.append(';'); sb.append(key.toString()); sb.append("="); //$NON-NLS-1$ sb.append(props.getProperty(key.toString())); i++;//ww w . j a v a 2s . co m } } }
From source file:Main.java
public static StringBuilder appendObject(StringBuilder sb, String label, Object object) { if (object == null) { return sb; }//ww w .ja v a2s. com sb.append("<" + label + ">"); sb.append(object.toString()); sb.append("</" + label + ">\n"); return sb; }
From source file:cc.kune.core.server.xmpp.RoomConfigurationDumper.java
/** * Log./*from w w w. j a va 2s . c o m*/ * * @param options * the options * @return the string */ private static String log(final Collection<? extends Object> options) { String s = ""; for (Object cs : options) { s += "| " + cs.toString(); } return s; }
From source file:com.adaptris.security.util.SecurityUtil.java
public static String getAlgorithms() { initialise();/* w w w . j av a 2s . co m*/ StringBuffer sb = new StringBuffer("Security Algorithms available"); for (Provider provider : Security.getProviders()) { sb.append("\nProvider : " + provider.toString() + "\n"); Object[] objs = provider.keySet().toArray(); Arrays.sort(objs); for (Object o : objs) { sb.append(o.toString() + ", "); } } return sb.toString(); }
From source file:com.karura.framework.utils.JsHelper.java
public static String literal(Object value) { return (value instanceof Number) ? value.toString() : stringLiteral(value); }
From source file:com.withub.common.SearchFilter.java
/** * searchParamskey?OPERATOR_FIELDNAME/*from ww w . ja va2 s .c o m*/ */ public static Map<String, SearchFilter> parse(Map<String, Object> searchParams) { Map<String, SearchFilter> filters = Maps.newHashMap(); for (Map.Entry<String, Object> entry : searchParams.entrySet()) { // String key = entry.getKey(); Object value = entry.getValue(); if (value == null || StringUtils.isBlank(value.toString())) { continue; } // operatorfiledAttribute String[] names = StringUtils.split(key, "_"); if (names.length != 2) { throw new IllegalArgumentException(key + " is not a valid search filter name"); } String filedName = names[1]; Operator operator = Operator.valueOf(names[0]); // searchFilter SearchFilter filter = new SearchFilter(filedName, operator, value); filters.put(key, filter); } return filters; }