/** * Converts an object to a string. */ public static String toString(Object value) { return EncodingUtils.toString(value); /* Code will move here once encodingutils no longer used // If A is a string, then the result is A. if(value instanceof String) return (String)value; // Otherwise, if A is null, then the result is "". if(value == null) return ""; // Otherwise, if is a DOM node, serialize the output // Get implemention from other EncodingUtils // Otherwise, if A.toString() throws an exception, then raise an error String str = value.toString(); // Otherwise, the result is A.toString(); return str; */ }
/** * @deprecated the effects of makeBr and makeNbsp should be handled by CSS white-space property. * @see TextInXhtmlEncoder */ @Deprecated public static void encodeHtml(Object value, boolean make_br, boolean make_nbsp, Appendable out) throws IOException { if(value!=null) { String str = toString(value); BundleLookupMarkup lookupMarkup; BundleLookupThreadContext threadContext = BundleLookupThreadContext.getThreadContext(false); if(threadContext!=null) { lookupMarkup = threadContext.getLookupMarkup(str); } else { lookupMarkup = null; } if(lookupMarkup!=null) lookupMarkup.appendPrefixTo(MarkupType.XHTML, out); encodeHtml(str, 0, str.length(), make_br, make_nbsp, out); if(lookupMarkup!=null) lookupMarkup.appendSuffixTo(MarkupType.XHTML, out); } }