protected CssClass(Element element) { super(ATTR_CLASS); classNames = Strings.split(element.getAttr(ATTR_CLASS)); if(this.classNames == null) { this.classNames = new ArrayList<String>(); } }
/** * Convert words separated by dash, underscore, space, slash and backslash to title case. Title case follows English * convention: uses space for separator and every word begin with upper case. Returns null or empty string if given * <code>string</code> parameter is null, respective empty. * * @param string string containing words to convert. * @return <code>string</code> converted to title case, null or empty. */ public static String toTitleCase(String string) { if(string == null) { return null; } if(string.isEmpty()) { return ""; } List<String> words = Strings.split(string, '-', '_', ' ', '/', '\\'); StringBuilder title = new StringBuilder(toCamelCase(words.get(0))); for(int i = 1; i < words.size(); ++i) { title.append(' '); title.append(toCamelCase(words.get(i))); } return title.toString(); }
/** * Set value to object field identified by object property path. Form this class perspective an object is a graph of value * types. A value type is a primitive value or a related boxing class. Also any class that can be converted to a primitive * are included; for example {@link File} or {@link URL} are value types since can be converted to/from strings. Opposite to * value types are compound entities, that is, objects, arrays and collections that aggregates value types or other compound * entities. * <p> * To sum up, an object is a graph with compound entities and value types as nodes where value types are leafs. The * <code>propertyPath</code> is the path through graph nodes till reach the value type and basically is a dot separated * field names list. * * @param propertyPath object property path, * @param value value to set. * @throws ConverterException if value is primitive and fail to convert to field type. * @throws IllegalAccessException this exception is required by reflective field signature but never thrown. */ private void setValue(String propertyPath, Object value) throws ConverterException, IllegalAccessException { List<String> nodeIDs = Strings.split(propertyPath, '.'); int lastNodeIndex = nodeIDs.size() - 1; Node node = new ObjectNode(object); for (int index = 0; index < lastNodeIndex; index++) { node = node.getChild(nodeIDs.get(index)); if (node == null) { return; } } node.setValue(nodeIDs.get(lastNodeIndex), value); }
locales = Strings.split(localeParameter, ','); for (String locale : locales) { log.debug("Register locale |%s| for request pre-processing.", locale); securityDomains = Strings.split(securityDomainParameter, ','); for (String securityDomain : securityDomains) { log.debug("Register security domain |%s| for request pre-processing.", securityDomain);
List<String> values = Strings.split(valuesString, ',');
List<String> strings = Strings.split(value, ','); if (type == String[].class) { return (T) strings.toArray(new String[strings.size()]);