List of usage examples for java.lang Object toString
public String toString()
From source file:Main.java
public static String toString(List<?> col) { StringBuilder buf = new StringBuilder(); buf.append("["); boolean first = true; for (Object o : col) { if (first) { first = false;/* w w w. ja v a2 s. c o m*/ } else { buf.append(", "); } buf.append(o.toString()); } buf.append("]"); return buf.toString(); }
From source file:eu.eidas.node.utils.PropertiesUtil.java
private static void initProps(Properties props) { LOG.info(LoggingMarkerMDC.SYSTEM_EVENT, "Loading properties"); propertiesMap = new HashMap<String, String>(); for (Object key : props.keySet()) { String keyStr = key.toString(); propertiesMap.put(keyStr, props.getProperty(keyStr)); }/*w w w. ja v a 2s . co m*/ if (eidasXmlLocation != null && !props.containsKey(MASTER_CONF_FILE_PARAM)) { String fileRepositoryDir = eidasXmlLocation.substring(0, eidasXmlLocation.length() - MASTER_CONF_FILE.length()); propertiesMap.put(MASTER_CONF_FILE_PARAM, fileRepositoryDir); props.put(MASTER_CONF_FILE_PARAM, fileRepositoryDir); } }
From source file:org.n52.restfulwpsproxy.serializer.json.AbstractWPSJsonModule.java
protected static final void writeStringFieldIfNotNull(JsonGenerator jg, String field, Object object) throws JsonGenerationException, IOException { if (object != null) { jg.writeStringField(field, object.toString()); }//from w w w .jav a2s .c om }
From source file:com.agiletec.plugins.jpnewsletter.aps.system.services.newsletter.util.ShaEncoder.java
protected static String mergeWordAndSalt(String word, Object salt, boolean strict) { if (word == null) { word = ""; }/* www . j a va2 s .co m*/ if (strict && (salt != null)) { if ((salt.toString().lastIndexOf("{") != -1) || (salt.toString().lastIndexOf("}") != -1)) { throw new IllegalArgumentException("Cannot use { or } in salt.toString()"); } } if ((salt == null) || "".equals(salt)) { return word; } else { return word + "{" + salt.toString() + "}"; } }
From source file:com.microsoft.alm.plugin.idea.common.ui.workitem.WorkItemHelper.java
public static String getFieldValue(@NotNull final WorkItem item, @NotNull final String fieldName) { final HashMap<String, Object> fieldMap = item.getFields(); if (fieldMap != null) { // Try a case sensitive search using the Map, // but if that doesn't work, loop through all the fields if (fieldMap.containsKey(fieldName)) { Object value = fieldMap.get(fieldName); if (value != null) { return value.toString(); }//from ww w . j a v a2 s. co m } else { for (final Map.Entry<String, Object> entry : fieldMap.entrySet()) { if (fieldName.equalsIgnoreCase(entry.getKey())) { if (entry.getValue() != null) { return entry.getValue().toString(); } } } } } return StringUtils.EMPTY; }
From source file:de.hybris.platform.mobileservices.text.MessageTestingUtilities.java
public static String toString(final Object object) { return object == null ? "" : object.toString(); }
From source file:Main.java
public static <T> String join(Collection<T> col, String separator) { String ret = ""; if (col != null && col.size() > 0) { for (Object x : col) { if (x instanceof String) { ret += separator + (String) x; } else { ret += separator + x.toString(); }/*from ww w . ja va2 s. c om*/ } } return ret.replaceFirst(separator, ""); }
From source file:org.apache.abdera2.common.protocol.RequestHelper.java
private static void initHeaders(RequestOptions options, HttpRequest request) { Iterable<String> headers = options.getHeaderNames(); for (String header : headers) { Iterable<Object> values = options.getHeaders(header); for (Object value : values) request.addHeader(header, value.toString()); }/* w ww . ja v a 2 s . c om*/ CacheControl cc = options.getCacheControl(); if (cc != null) { String scc = cc.toString(); if (scc.length() > 0) request.setHeader("Cache-Control", scc); } // TODO: Authentication setup per request??? // if (options.getAuthorization() != null) // method.setDoAuthentication(false); }
From source file:ch.entwine.weblounge.bridge.oaipmh.util.OsgiUtil.java
/** * Get a mandatory, non-blank value from a dictionary. * /*from ww w . j a va 2 s. c o m*/ * @throws ConfigurationException * key does not exist or its value is blank */ public static String getCfg(Dictionary d, String key) throws ConfigurationException { Object p = d.get(key); if (p == null) throw new ConfigurationException(key, "does not exist"); String ps = p.toString(); if (StringUtils.isBlank(ps)) throw new ConfigurationException(key, "is blank"); return ps; }
From source file:com.datastax.sparql.ConsoleCompiler.java
private static void printWithHeadline(final String headline, final Object content) throws IOException { final StringReader sr = new StringReader(content != null ? content.toString() : "null"); final BufferedReader br = new BufferedReader(sr); String line;//from w ww. j a va 2 s . c om System.out.println(); System.out.println(headline); //Not sure what this is :-/ System.out.println(); boolean skip = true; while (null != (line = br.readLine())) { skip &= line.isEmpty(); if (!skip) { System.out.println(" " + line); } } System.out.println(); br.close(); sr.close(); }