List of usage examples for java.lang Object toString
public String toString()
From source file:com.threewks.thundr.view.jsp.el.CollectionFunctions.java
/** * Joins the given collection or array using the object toString and the given separator. * @param collectionOrArray a {@link Collection} or array of object * @param separator the separator token to use when joining the content of the given collection *///from ww w .j a va 2 s . c o m public static String join(Object collectionOrArray, Object separator) { List<Object> collection = toCollection(collectionOrArray); return StringUtils.join(collection, separator == null ? "" : separator.toString()); }
From source file:Main.java
public static boolean containsAttribute(Element element, Object name, Object value) { if (element == null) { return false; }/* w w w .j a v a 2 s. c o m*/ Object attribute = element.getAttributes().getAttribute(name); if (attribute == null) { return containsAttribute(element.getParentElement(), name, value); } return value.equals(attribute.toString()); }
From source file:com.cisco.dbds.utils.logging.LogHandler.java
/** * Prints the to console.//w ww . jav a2 s . c om * * @param message the message */ public static void printToConsole(Object message) { System.out.println(message.toString()); }
From source file:com.webbfontaine.valuewebb.irms.factory.core.AbstractActionProcessor.java
private static boolean notFailed(Object proceed) { Validate.notNull(proceed, "Alert intercepted method cannot return null"); return !Constants.FAILED.equals(proceed.toString()); }
From source file:edu.utah.further.core.api.discrete.EnumUtil.java
/** * Returns the enum constant of the specified enum type with the specified name. The * name must match exactly an identifier used to declare an enum constant in this * type. If it does not, this method returns <code>null</code>. * * @param enumType//from w w w . j a v a 2s. c o m * the Class object of the enum type from which to return a constant * @param name * the name of the constant to return * @return the enum constant of the specified enum type with the specified name or * <code>null</code> if not found * @see {link Enum.valueOf} */ public static <E extends Enum<E>> E valueOfNullSafe(final Class<E> enumType, final Object object) { return (object == null) ? null : valueOfNullSafe(enumType, object.toString()); }
From source file:Main.java
public static String getId(Node node) { try {//from ww w. jav a2s . co m NamedNodeMap nnm = node.getAttributes(); Node attrib = nnm.getNamedItem("Id"); Object ID; if (attrib.hasChildNodes()) { ID = attrib.getChildNodes().item(0).getNodeValue(); } else { ID = attrib.getNodeValue(); } return ID.toString(); } catch (Exception ex) { return ""; } }
From source file:com.p000ison.dev.copybooks.util.Helper.java
public static ArrayList<String> fromJSONStringtoList(String key, String string) { if (string != null && !string.isEmpty()) { ArrayList<String> out = new ArrayList<String>(); JSONObject flags = (JSONObject) JSONValue.parse(string); if (flags != null) { for (Object keys : flags.keySet()) { try { if (keys.equals(key)) { JSONArray list = (JSONArray) flags.get(keys); if (list != null) { for (Object k : list) { out.add(k.toString()); }/*www.j a v a 2 s .c o m*/ } } } catch (Exception ex) { CopyBooks.debug(String.format("Failed reading flag: %s", keys)); CopyBooks.debug(String.format("Value: %s", flags.get(key))); CopyBooks.debug(null, ex); } } } return out; } return null; }
From source file:api.util.JsonUtil.java
public static String asString(Object val) { if (val == JSONObject.NULL) return null; return val.toString(); }
From source file:edu.indiana.lib.twinpeaks.util.LogUtils.java
/** * Serialize an XML object (Document or Element) to the log (with an * optional warning header)//from w w w . ja v a 2s .c o m * @param log Apache Log object * @param errorText Error message (null for none) * @param recordElement The XML object to disolay (Document, Element) */ public static void displayXml(org.apache.commons.logging.Log log, String errorText, Object xmlObject) { if (!(xmlObject instanceof Document) && !(xmlObject instanceof Element)) { throw new IllegalArgumentException("Unexpected object for serialzation: " + xmlObject.toString()); } if (!StringUtils.isNull(errorText)) { log.error(errorText); } log.info("Record Start ----------------------------------------"); try { log.info(DomUtils.serialize(xmlObject)); } catch (DomException exception) { log.error("Failed to serialize element " + xmlObject.toString(), exception); } log.info("Record End ------------------------------------------"); }
From source file:com.espertech.esper.util.ThreadLogUtil.java
private static void write(String text, Object... objects) { StringBuilder buf = new StringBuilder(); buf.append(text);//w w w. ja v a2s. co m buf.append(' '); for (Object obj : objects) { if ((obj instanceof String) || (obj instanceof Number)) { buf.append(obj.toString()); } else { buf.append(obj.getClass().getSimpleName()); buf.append('@'); buf.append(Integer.toHexString(obj.hashCode())); } buf.append(' '); } write(buf.toString()); }