public class StringUtils extends Object
Modifier and Type | Field and Description |
---|---|
static String |
NAME_CACHE_EXPIRY_PROPERTY
Set the cache expiry (in seconds) of the sanitizedNameCache, camelizedWordsCache and underscoreWordsCache.
|
static String |
NAME_CACHE_SIZE_PROPERTY
Set the cache size (entry count) of the sanitizedNameCache, camelizedWordsCache and underscoreWordsCache.
|
Constructor and Description |
---|
StringUtils() |
Modifier and Type | Method and Description |
---|---|
static String |
camelize(String word)
Camelize name (parameter, property, method, etc) with upper case for first letter
copied from Twitter elephant bird
https://github.com/twitter/elephant-bird/blob/master/core/src/main/java/com/twitter/elephantbird/util/Strings.java
|
static String |
camelize(String inputWord,
boolean lowercaseFirstLetter)
Camelize name (parameter, property, method, etc)
|
static String |
dashize(String word)
Dashize the given word.
|
static String |
escape(String name,
Map<String,String> replacementMap,
List<String> charactersToAllow,
String appendToReplacement)
Return the name with escaped characters.
|
static String |
underscore(String word)
Underscore the given word.
|
public static final String NAME_CACHE_SIZE_PROPERTY
public static final String NAME_CACHE_EXPIRY_PROPERTY
public static String underscore(String word)
word
- The wordpublic static String dashize(String word)
word
- The wordpublic static String camelize(String word)
word
- string to be camelizepublic static String camelize(String inputWord, boolean lowercaseFirstLetter)
inputWord
- string to be camelizelowercaseFirstLetter
- lower case for first letter if set to truepublic static String escape(String name, Map<String,String> replacementMap, List<String> charactersToAllow, String appendToReplacement)
name
- the name to be escapedreplacementMap
- map of replacement characters for non-allowed characterscharactersToAllow
- characters that are not escapedappendToReplacement
- String to append to replaced characters.throws Runtime exception as word is not escaped properly.
Copyright © 2021. All rights reserved.