/** * Converts strings to lowerCamelCase. This method will also use any extra delimiter characters to identify word boundaries. * <p> * Examples: * * <pre> * inflector.lowerCamelCase("active_record") #=> "activeRecord" * inflector.lowerCamelCase("first_name") #=> "firstName" * inflector.lowerCamelCase("name") #=> "name" * inflector.lowerCamelCase("the-first_name",'-') #=> "theFirstName" * </pre> * * </p> * * @param lowerCaseAndUnderscoredWord the word that is to be converted to camel case * @param delimiterChars optional characters that are used to delimit word boundaries * @return the lower camel case version of the word * @see #underscore(String, char[]) * @see #camelCase(String, boolean, char[]) * @see #upperCamelCase(String, char[]) */ public String lowerCamelCase( String lowerCaseAndUnderscoredWord, char... delimiterChars ) { return camelCase(lowerCaseAndUnderscoredWord, false, delimiterChars); }
/** * Converts strings to lowerCamelCase. This method will also use any extra delimiter characters to identify word boundaries. * <p> * Examples: * * <pre> * inflector.lowerCamelCase("active_record") #=> "activeRecord" * inflector.lowerCamelCase("first_name") #=> "firstName" * inflector.lowerCamelCase("name") #=> "name" * inflector.lowerCamelCase("the-first_name",'-') #=> "theFirstName" * </pre> * * </p> * * @param lowerCaseAndUnderscoredWord the word that is to be converted to camel case * @param delimiterChars optional characters that are used to delimit word boundaries * @return the lower camel case version of the word * @see #underscore(String, char[]) * @see #camelCase(String, boolean, char[]) * @see #upperCamelCase(String, char[]) */ public String lowerCamelCase( String lowerCaseAndUnderscoredWord, char... delimiterChars ) { return camelCase(lowerCaseAndUnderscoredWord, false, delimiterChars); }
/** * Converts strings to UpperCamelCase. This method will also use any extra delimiter characters to identify word boundaries. * <p> * Examples: * * <pre> * inflector.upperCamelCase("active_record") #=> "SctiveRecord" * inflector.upperCamelCase("first_name") #=> "FirstName" * inflector.upperCamelCase("name") #=> "Name" * inflector.lowerCamelCase("the-first_name",'-') #=> "TheFirstName" * </pre> * * </p> * * @param lowerCaseAndUnderscoredWord the word that is to be converted to camel case * @param delimiterChars optional characters that are used to delimit word boundaries * @return the upper camel case version of the word * @see #underscore(String, char[]) * @see #camelCase(String, boolean, char[]) * @see #lowerCamelCase(String, char[]) */ public String upperCamelCase( String lowerCaseAndUnderscoredWord, char... delimiterChars ) { return camelCase(lowerCaseAndUnderscoredWord, true, delimiterChars); }
/** * Converts strings to UpperCamelCase. This method will also use any extra delimiter characters to identify word boundaries. * <p> * Examples: * * <pre> * inflector.upperCamelCase("active_record") #=> "SctiveRecord" * inflector.upperCamelCase("first_name") #=> "FirstName" * inflector.upperCamelCase("name") #=> "Name" * inflector.lowerCamelCase("the-first_name",'-') #=> "TheFirstName" * </pre> * * </p> * * @param lowerCaseAndUnderscoredWord the word that is to be converted to camel case * @param delimiterChars optional characters that are used to delimit word boundaries * @return the upper camel case version of the word * @see #underscore(String, char[]) * @see #camelCase(String, boolean, char[]) * @see #lowerCamelCase(String, char[]) */ public String upperCamelCase( String lowerCaseAndUnderscoredWord, char... delimiterChars ) { return camelCase(lowerCaseAndUnderscoredWord, true, delimiterChars); }
/** * Converts strings to lowerCamelCase. This method will also use any extra delimiter characters to identify word boundaries. * <p> * Examples: * * <pre> * inflector.lowerCamelCase("active_record") #=> "activeRecord" * inflector.lowerCamelCase("first_name") #=> "firstName" * inflector.lowerCamelCase("name") #=> "name" * inflector.lowerCamelCase("the-first_name",'-') #=> "theFirstName" * </pre> * * </p> * * @param lowerCaseAndUnderscoredWord the word that is to be converted to camel case * @param delimiterChars optional characters that are used to delimit word boundaries * @return the lower camel case version of the word * @see #underscore(String, char[]) * @see #camelCase(String, boolean, char[]) * @see #upperCamelCase(String, char[]) */ public String lowerCamelCase( String lowerCaseAndUnderscoredWord, char... delimiterChars ) { return camelCase(lowerCaseAndUnderscoredWord, false, delimiterChars); }
/** * Converts strings to UpperCamelCase. This method will also use any extra delimiter characters to identify word boundaries. * <p> * Examples: * * <pre> * inflector.upperCamelCase("active_record") #=> "SctiveRecord" * inflector.upperCamelCase("first_name") #=> "FirstName" * inflector.upperCamelCase("name") #=> "Name" * inflector.lowerCamelCase("the-first_name",'-') #=> "TheFirstName" * </pre> * * </p> * * @param lowerCaseAndUnderscoredWord the word that is to be converted to camel case * @param delimiterChars optional characters that are used to delimit word boundaries * @return the upper camel case version of the word * @see #underscore(String, char[]) * @see #camelCase(String, boolean, char[]) * @see #lowerCamelCase(String, char[]) */ public String upperCamelCase( String lowerCaseAndUnderscoredWord, char... delimiterChars ) { return camelCase(lowerCaseAndUnderscoredWord, true, delimiterChars); }
/** * Find the property names with getter methods on the target class. This method returns the property names for the methods * returned by {@link #findGetterMethods()}. * * @return the Java Bean property names for the getters; never null but possibly empty */ public String[] findGetterPropertyNames() { final Method[] getters = findGetterMethods(); final List<String> result = new ArrayList<String>(); for (int i = 0; i < getters.length; i++) { final Method m = getters[i]; String name = m.getName(); String propertyName = null; if (name.startsWith("get") && name.length() > 3) { propertyName = name.substring(3); } else if (name.startsWith("is") && name.length() > 2) { propertyName = name.substring(2); } else if (name.startsWith("are") && name.length() > 3) { propertyName = name.substring(3); } if (propertyName != null) { propertyName = INFLECTOR.camelCase(INFLECTOR.underscore(propertyName), false); result.add(propertyName); } } return result.toArray(new String[result.size()]); }
/** * Find the property names with getter methods on the target class. This method returns the property names for the methods * returned by {@link #findGetterMethods()}. * * @return the Java Bean property names for the getters; never null but possibly empty */ public String[] findGetterPropertyNames() { final Method[] getters = findGetterMethods(); final List<String> result = new ArrayList<String>(); for (int i = 0; i < getters.length; i++) { final Method m = getters[i]; String name = m.getName(); String propertyName = null; if (name.startsWith("get") && name.length() > 3) { propertyName = name.substring(3); } else if (name.startsWith("is") && name.length() > 2) { propertyName = name.substring(2); } else if (name.startsWith("are") && name.length() > 3) { propertyName = name.substring(3); } if (propertyName != null) { propertyName = INFLECTOR.camelCase(INFLECTOR.underscore(propertyName), false); result.add(propertyName); } } return result.toArray(new String[result.size()]); }
/** * Find the property names with getter methods on the target class. This method returns the property names for the methods * returned by {@link #findGetterMethods()}. * * @return the Java Bean property names for the getters; never null but possibly empty */ public String[] findGetterPropertyNames() { final Method[] getters = findGetterMethods(); final List<String> result = new ArrayList<String>(); for (int i = 0; i < getters.length; i++) { final Method m = getters[i]; String name = m.getName(); String propertyName = null; if (name.startsWith("get") && name.length() > 3) { propertyName = name.substring(3); } else if (name.startsWith("is") && name.length() > 2) { propertyName = name.substring(2); } else if (name.startsWith("are") && name.length() > 3) { propertyName = name.substring(3); } if (propertyName != null) { propertyName = INFLECTOR.camelCase(INFLECTOR.underscore(propertyName), false); result.add(propertyName); } } return result.toArray(new String[result.size()]); }
+ camelCase(lowerCaseAndUnderscoredWord, true, delimiterChars).substring(1);
+ camelCase(lowerCaseAndUnderscoredWord, true, delimiterChars).substring(1);
+ camelCase(lowerCaseAndUnderscoredWord, true, delimiterChars).substring(1);
public void upperCamelCase( String word, String expectedCamelized, char... delimiterChars ) { // Test uppercasing the string String actualCamelized = inflector.camelCase(word, true, delimiterChars); assertEquals(expectedCamelized, actualCamelized); assertEquals(expectedCamelized, inflector.upperCamelCase(word, delimiterChars)); if (delimiterChars == null || delimiterChars.length == 0) { // Test underscoring the camelized word ... String actualUnderscored = inflector.underscore(expectedCamelized); assertEquals(word, actualUnderscored); } }
public void lowerCamelCase( String word, String expectedCamelized, char... delimiterChars ) { // Test lowercasing the string String actualCamelized = inflector.camelCase(word, false, delimiterChars); assertEquals(expectedCamelized, actualCamelized); assertEquals(expectedCamelized, inflector.lowerCamelCase(word, delimiterChars)); if (delimiterChars == null || delimiterChars.length == 0) { // Test underscoring the camelized word ... String actualUnderscored = inflector.underscore(expectedCamelized); assertEquals(word, actualUnderscored); } }