List of usage examples for org.apache.commons.lang WordUtils uncapitalize
public static String uncapitalize(String str)
Uncapitalizes all the whitespace separated words in a String.
From source file:org.oscarehr.util.SpringUtils.java
public static <T> T getBean(Class clazz) { return (T) beanFactory.getBean(WordUtils.uncapitalize(clazz.getSimpleName())); }
From source file:org.ptg.cep.SQLParserGenerator.java
public String fixGetter(String s) { String[] parts = s.split("\\."); if (parts.length == 2) { if (parts[1].indexOf("get") == -1) { return parts[1]; } else {/* ww w . j a v a 2 s . c o m*/ return WordUtils.uncapitalize(parts[1].substring(3, parts[1].length())); } } else { if (s.indexOf("get") == -1) { return s; } else { return WordUtils.uncapitalize(s.substring(s.indexOf("get"), s.length())); } } }
From source file:org.querybyexample.jpa.JpaUniqueUtil.java
private String simpleUniqueConstraintError(Identifiable<?> entity, String property) { return WordUtils.uncapitalize(getEntityName(entity)) + "_" + property + "_already_exists"; }
From source file:org.querybyexample.jpa.JpaUniqueUtil.java
private String compositeUniqueConstraintErrorCode(Identifiable<?> entity, UniqueConstraint uniqueConstraint) { return WordUtils.uncapitalize(getEntityName(entity)) + "_" + (uniqueConstraint.name() == null ? "composite_unique_constraint_error" : uniqueConstraint.name().toLowerCase()); }
From source file:org.rascalmpl.library.Prelude.java
public IString uncapitalize(IString src) { return values.string(WordUtils.uncapitalize(src.getValue())); }
From source file:org.richfaces.tests.showcase.AbstractShowcaseTest.java
protected String getAdditionToContextRoot() { // sample name - removes Test- prefix from class name and uncapitalize // first letter String sampleName = this.getClass().getSimpleName().substring(4); sampleName = WordUtils.uncapitalize(sampleName); // demo name - takes last part of package name String demoName = this.getClass().getPackage().getName(); demoName = StringUtils.substringAfterLast(demoName, "."); ShowcaseLayout layout = loadLayout(); String addition;//from w w w . j av a2 s . c o m if (layout == ShowcaseLayout.COMMON) { addition = SimplifiedFormat.format("richfaces/component-sample.jsf?skin=blueSky&demo={0}&sample={1}", demoName, sampleName); } else { addition = SimplifiedFormat.format("mobile/#{0}:{1}", demoName, sampleName); } return addition; }
From source file:org.sprintapi.hyperdata.gson.HyperDataAdapterFactory.java
@SuppressWarnings("unchecked") @Override//from w ww . java2s .c o m public <T> TypeAdapter<T> create(Gson gson, TypeToken<T> type) { Class<? super T> raw = type.getRawType(); if (!Object.class.isAssignableFrom(raw) || HyperMap.class.isAssignableFrom(raw)) { return null; // it's a primitive or HyperMap } if (!raw.isAnnotationPresent(HyperdataContainer.class)) { return null; // it's not hyperdata } MetadataAccess metadataAccess = new MetadataAccess(); Set<String> profiles = new LinkedHashSet<String>(); Class<?> c = raw; while (c != null) { if (c.getClass().equals(Object.class)) { break; } HyperdataContainer hdc = c.getAnnotation(HyperdataContainer.class); if ((hdc != null) && (hdc.profile().length > 0)) { profiles.addAll(Arrays.asList(hdc.profile())); } Class<?>[] interfaces = c.getInterfaces(); if (interfaces != null) { for (Class<?> i : interfaces) { hdc = i.getAnnotation(HyperdataContainer.class); if ((hdc != null) && (hdc.profile().length > 0)) { profiles.addAll(Arrays.asList(hdc.profile())); } } } c = c.getSuperclass(); } metadataAccess.profile = profiles.toArray(new String[0]); for (Method method : raw.getMethods()) { if (method.isAnnotationPresent(MetadataContainer.class)) { if (method.getName().startsWith("get")) { metadataAccess.getter = method; metadataAccess.fieldName = method.getName().substring(3); } else if (method.getName().startsWith("set")) { metadataAccess.setter = method; metadataAccess.fieldName = method.getName().substring(3); } } } if (metadataAccess.fieldName != null) { if (metadataAccess.getter == null) { for (Method method : raw.getMethods()) { if (method.getName().equals("get" + metadataAccess.fieldName)) { metadataAccess.getter = method; break; } } } else if (metadataAccess.setter == null) { for (Method method : raw.getMethods()) { if (method.getName().equals("set" + metadataAccess.fieldName)) { metadataAccess.setter = method; break; } } } metadataAccess.fieldName = WordUtils.uncapitalize(metadataAccess.fieldName); } ObjectConstructor<T> constructor = constructorConstructor.get(type); return (TypeAdapter<T>) new HyperDataTypeAdapter(metadataAccess, constructorConstructor, (ObjectConstructor<Object>) constructor, getBoundFields(gson, type, raw), gson, this); }
From source file:StorageHelper.PathParser.java
/** * find all the paths in the json Object that will match the key * @param searchKey key searching for/*from w w w . ja v a2 s .c om*/ * @param searching object searching in * @return list of arrays, array being the path list of all the paths */ private ArrayList<String[]> findPaths(String searchKey, JSONObject searching) { Iterator<String> keys = searching.keys(); ArrayList<String[]> allPaths = new ArrayList<>(); //adding found key to array if (searching.has(WordUtils.capitalize(searchKey)) || searching.has(WordUtils.uncapitalize(searchKey))) { allPaths.add(new String[] { searchKey }); } while (keys.hasNext()) { ArrayList<String[]> foundPaths; String next = keys.next(); //get the next one, either as json object or json array Object nextJson = null; try { nextJson = searching.get(next); } catch (JSONException e) { e.printStackTrace(); } foundPaths = findPathsRecurser(searchKey, nextJson); //add the path to the main collection of paths for (String[] paths : foundPaths) { ArrayList<String> pathFinder = new ArrayList<>(); pathFinder.add(next); pathFinder.addAll(Arrays.asList(paths)); allPaths.add(pathFinder.toArray(new String[pathFinder.size()])); } } return allPaths; }