List of usage examples for org.apache.commons.lang3 StringUtils capitalize
public static String capitalize(final String str)
Capitalizes a String changing the first letter to title case as per Character#toTitleCase(char) .
From source file:com.vrem.wifianalyzer.wifi.band.WiFiChannelCountryGHZ2.java
SortedSet<Integer> findChannels(@NonNull String countryCode) { SortedSet<Integer> results = new TreeSet<>(world); String code = StringUtils.capitalize(countryCode); if (countries.contains(code)) { results = new TreeSet<>(channels); }// ww w . jav a2s. c o m return results; }
From source file:com.gammalabs.wifianalyzer.wifi.band.WiFiChannelCountryGHZ2.java
SortedSet<Integer> findChannels(@NonNull String countryCode) { SortedSet<Integer> result = world; String code = StringUtils.capitalize(countryCode); if (countries.contains(code)) { result = channels;/*from ww w .j a v a 2 s. c o m*/ } return Collections.unmodifiableSortedSet(result); }
From source file:com.github.benmanes.caffeine.cache.simulator.policy.product.CollisionPolicy.java
public CollisionPolicy(CollisionSettings settings, Density density) { policyStats = new PolicyStats( String.format("product.Collision (%s)", StringUtils.capitalize(density.name().toLowerCase()))); maximumSize = settings.maximumSize(); CollisionBuilder<Object> builder = CollisionCache.withCapacity(maximumSize) .setInitCount(settings.initCount()).setBucketSize(settings.bucketSize()) .setStrictCapacity(settings.strictCapacity()); if (density == Density.SPARSE) { cache = builder.buildSparse(settings.sparseFactor()); } else if (density == Density.PACKED) { cache = builder.buildPacked();/* w w w . j a v a2 s . com*/ } else { throw new IllegalArgumentException(); } }
From source file:com.proteanplatform.protean.entity.EntityTableCellMetadata.java
/** * @param clazz//from w w w . ja v a 2 s. c o m * @param anno * @throws NoSuchMethodException */ public EntityTableCellMetadata(String name, Class<?> clazz) throws NoSuchMethodException { Method method = null; Class<?> rtype = clazz; String[] tokens = name.split("\\."); for (int i = 0; i < tokens.length - 1; ++i) { method = rtype.getMethod("get" + StringUtils.capitalize(tokens[i]), new Class[0]); methods.add(method); rtype = method.getReturnType(); } method = rtype.getMethod("get" + StringUtils.capitalize(tokens[tokens.length - 1]), new Class[0]); rtype = method.getReturnType(); String type = "string"; // determines sortability // have to do string, date first, since they can both assign object. if (String.class.isAssignableFrom(rtype)) { methods.add(method); } else if (Date.class.isAssignableFrom(rtype)) { methods.add(method); type = "date"; } else if (rtype == boolean.class || rtype == char.class || rtype == Boolean.class || rtype == Character.class) { methods.add(method); } else if (rtype.isPrimitive() || rtype == int.class || rtype == Integer.class || rtype == Long.class || rtype == Short.class || rtype == Byte.class || rtype == Double.class || rtype == Float.class) { methods.add(method); type = "numeric"; } else if (Object.class.isAssignableFrom(rtype)) { calculateObjectCell(method); } column = new TableColumn(name, type, Sorting.BOTH); }
From source file:com.nerve.commons.repository.utils.reflection.ReflectionUtils.java
/** * Getter./* w w w. j a va2 s . co m*/ * ???.??. */ public static Object invokeGetter2(Object obj, String propertyName) { Object object = obj; for (String name : StringUtils.split(propertyName, ".")) { String getterMethodName = GETTER_PREFIX + StringUtils.capitalize(name); object = invokeMethod(object, getterMethodName, new Class[] {}, new Object[] {}); } return object; }
From source file:com.eprosima.idl.parser.typecode.Member.java
public String getJavaName() { if (m_name != null) { // @dcalvert: Fix Java method naming from getSome_type() to getSomeType() if (m_name.contains("_")) { return FormattingTools.underscoredToCamelCase(m_name, true); } else {//from www. ja v a 2 s .c o m return StringUtils.capitalize(m_name); } } return null; }
From source file:com.salesforce.ide.apex.internal.core.tooling.systemcompletions.model.Type.java
void afterUnmarshal(Unmarshaller unmarshaller, Object parent) { name = StringUtils.capitalize(name); if (publicDeclarations.constructors != null) { for (Constructor c : publicDeclarations.constructors) { String lowerCase = c.name.toLowerCase(); ArrayList<AbstractCompletionProposalDisplayable> list = constructorTrie.get(lowerCase); if (list == null) { list = Lists.newArrayList(); }// w w w .j a v a 2 s. c om list.add(c); constructorTrie.put(lowerCase, list); } } if (publicDeclarations.methods != null) { for (Method m : publicDeclarations.methods) { String lowerCase = m.name.toLowerCase(); ArrayList<AbstractCompletionProposalDisplayable> list = methodTrie.get(lowerCase); if (list == null) { list = Lists.newArrayList(); } list.add(m); methodTrie.put(lowerCase, list); } } if (publicDeclarations.properties != null) { for (Property p : publicDeclarations.properties) { propertyTrie.put(p.name.toLowerCase(), p); } } }
From source file:com.github.cherimojava.data.mongo.entity.EntityUtils.java
/** * Capitalizes a String. I.e. the first Letter will be converted into uppercase, all other letters will stay as is. * For inversion see {@link #decapitalize(String)}. * * @param name string to capitalize./*ww w .j ava 2 s . c o m*/ * @return capitalized string * @see #decapitalize(String) */ public static String capitalize(String name) { return StringUtils.capitalize(name); }
From source file:com.mh.commons.utils.Reflections.java
/** * Setter./*from w w w . jav a2s . co m*/ * * @param propertyType Setter,valueClass. */ public static void invokeSetterMethod(Object target, String propertyName, Object value, Class<?> propertyType) { Class<?> type = propertyType != null ? propertyType : value.getClass(); String setterMethodName = "set" + StringUtils.capitalize(propertyName); invokeMethod(target, setterMethodName, new Class[] { type }, new Object[] { value }); }
From source file:net.fabricmc.loom.mixin.ObfuscationServiceFabric.java
private String asSuffixed(String arg, String from, String to) { return arg + StringUtils.capitalize(from) + StringUtils.capitalize(to); }