@Override public TypeSerializer buildTypeSerializer(SerializationConfig config, JavaType baseType, Collection<NamedType> subtypes) { return noTypeInfo(baseType) ? null : new AsPropertyTypeSerializerEx(_customIdResolver, null, _typeProperty); }
/** * Parses XML from a list of strings. * * @param xml String iterable containing valid XML. * @return XML document. * @throws Exception Unspecified exception. */ public static Document parseXMLFromList(Iterable<String> xml) throws Exception { return parseXMLFromString(StrUtil.fromList(xml)); }
/** * Formats a message. If the message begins with "@", the remainder is assumed to be a label * identifier that is resolved. * * @param msg Message to format or, if starts with "@", a label reference. * @param args Optional replaceable parameters. * @return The formatted message. */ public static String formatMessage(String msg, Object... args) { return formatMessage(msg, null, args); }
/** * Converts a date/time value to a string, using the format dd-mmm-yyyy hh:mm. Because we cannot * determine the absence of a time from a time of 24:00, we must assume a time of 24:00 means * that no time is present and strip that from the return value. * * @param date Date value to convert. * @return Formatted string representation of the specified date, or an empty string if date is * null. */ public static String formatDate(Date date) { return formatDate(date, false, false); }
/** * Sets the end date. * * @param endDate The end date. */ private void setEndDate(String endDate) { this.rawEndDate = endDate; this.endDate = DateUtil.parseDate(endDate); }
/** * Splits a string using the specified delimiter. * * @param text The string to split. * @param delimiter The delimiter for the split operation. * @return A string array containing the split values. The returned array is guaranteed not to * contain null values by replacing every occurrence of a null value with an empty * string. */ public static String[] split(String text, String delimiter) { return split(text, delimiter, 0); }
/** * Returns a Color object that corresponds to the value. * * @param value The string representation of the color. This may be a color name or a text * representation of the color's rgb value. * @return The Color object corresponding to the value, or null if not a recognized value. */ public static Color toColor(String value) { return toColor(value, null); }
/** * Returns the text representation of the generated schema. */ @Override public String toString() { return XMLUtil.toString(schema); }
/** * Serializes an object to JSON format. * * @param object Object to be serialized. * @param prettyPrint If true, format output for display. * @return Serialized form of the object in JSON format. */ public static String serialize(Object object, boolean prettyPrint) { return serialize(null, object, prettyPrint); }
@Override protected Object handleGetObject(String key) { return Localizer.getMessage(key, getLocale()); }
/** * Return elapsed time in ms to displayable format with units. * * @param elapsed Elapsed time in ms. * @return Elapsed time in displayable format. */ public static String formatElapsed(double elapsed) { return formatElapsed(elapsed, true, false, false); }
/** * Extracts an integer portion at the beginning of a string. Parsing stops when a non-digit * character or the end of the string is encountered. * * @param value String value to parse * @return The integer value at the beginning of the string. */ public static int extractInt(String value) { return toInt(extractIntPrefix(value)); }
private static String getDurationUnits(TimeUnit accuracy, boolean plural, boolean abbreviated) { return getDurationUnits(accuracy.ordinal(), plural, abbreviated); }
@Test public void testSerializer() { JSONUtil.registerAlias("TestPerson", TestPerson.class); testSerializer(null); testSerializer("resourceType"); }
/** * Returns the default locale. * * @return The default locale. */ public static Locale getDefaultLocale() { return localeResolver.getLocale(); }
@Override public boolean containsKey(String key) { return handleGetObject(key) != null; } }
/** * Returns a new logger instance wrapping the specified logger. * * @param log Logger to wrap. * @return A new logger instance or, if the original logger was already an instance of Logger, * that instance is returned. */ public static Logger create(Log log) { return log instanceof Logger ? (Logger) log : new Logger(log); }
/** * Return elapsed time in ms to displayable format with units. * * @param elapsed Elapsed time in ms. * @param pluralize If true, pluralize units when appropriate. * @param abbreviated If true, use abbreviated form of units. * @param round If true, round result to an integer. * @return Elapsed time in displayable format. */ public static String formatElapsed(double elapsed, boolean pluralize, boolean abbreviated, boolean round) { return formatElapsed(elapsed, pluralize, abbreviated, round, null); }