Package org.mapstruct.ap.internal.util
Class Strings
- java.lang.Object
-
- org.mapstruct.ap.internal.util.Strings
-
public class Strings extends java.lang.ObjectHelper class for dealing with strings.
-
-
Field Summary
Fields Modifier and Type Field Description private static java.util.Set<java.lang.String>KEYWORDSprivate static charUNDERSCORE
-
Constructor Summary
Constructors Modifier Constructor Description privateStrings()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static java.lang.Stringcapitalize(java.lang.String string)static java.lang.Stringdecapitalize(java.lang.String string)(package private) static java.lang.Iterable<java.lang.String>extractParts(java.lang.String name)It removes the dots from the name and creates anIterablefrom them.static java.lang.StringgetMostSimilarWord(java.lang.String word, java.util.Collection<java.lang.String> similarWords)static java.lang.StringgetSafeVariableName(java.lang.String name, java.lang.String... existingVariableNames)static java.lang.StringgetSafeVariableName(java.lang.String name, java.util.Collection<java.lang.String> existingVariableNames)Returns a variable name which doesn't conflict with the given variable names existing in the same scope and the Java keywords.static booleanisEmpty(java.lang.String string)static booleanisNotEmpty(java.lang.String string)static java.lang.Stringjoin(java.lang.Iterable<?> iterable, java.lang.String separator)static <T> java.lang.Stringjoin(java.lang.Iterable<T> iterable, java.lang.String separator, Extractor<T,java.lang.String> extractor)static java.lang.StringjoinAndCamelize(java.lang.Iterable<?> iterable)private static intlevenshteinDistance(java.lang.String s, java.lang.String t)static java.lang.StringsanitizeIdentifierName(java.lang.String identifier)static java.lang.StringstubPropertyName(java.lang.String fullyQualifiedName)Returns a stub property name from full class name by stripping away the package and decapitalizing the name For example will returnfooBarforcom.foo.bar.baz.FooBarclass name
-
-
-
Field Detail
-
KEYWORDS
private static final java.util.Set<java.lang.String> KEYWORDS
-
UNDERSCORE
private static final char UNDERSCORE
- See Also:
- Constant Field Values
-
-
Method Detail
-
capitalize
public static java.lang.String capitalize(java.lang.String string)
-
decapitalize
public static java.lang.String decapitalize(java.lang.String string)
-
join
public static java.lang.String join(java.lang.Iterable<?> iterable, java.lang.String separator)
-
join
public static <T> java.lang.String join(java.lang.Iterable<T> iterable, java.lang.String separator, Extractor<T,java.lang.String> extractor)
-
joinAndCamelize
public static java.lang.String joinAndCamelize(java.lang.Iterable<?> iterable)
-
isEmpty
public static boolean isEmpty(java.lang.String string)
-
isNotEmpty
public static boolean isNotEmpty(java.lang.String string)
-
getSafeVariableName
public static java.lang.String getSafeVariableName(java.lang.String name, java.lang.String... existingVariableNames)
-
getSafeVariableName
public static java.lang.String getSafeVariableName(java.lang.String name, java.util.Collection<java.lang.String> existingVariableNames)Returns a variable name which doesn't conflict with the given variable names existing in the same scope and the Java keywords.- Parameters:
name- the name to get a safe version forexistingVariableNames- the names of other variables existing in the same scope- Returns:
- a variable name based on the given original name, not conflicting with any of the given other names or any Java keyword; starting with a lower-case letter
-
sanitizeIdentifierName
public static java.lang.String sanitizeIdentifierName(java.lang.String identifier)
- Parameters:
identifier- identifier to sanitize- Returns:
- the identifier without any characters that are not allowed as part of a Java identifier.
-
stubPropertyName
public static java.lang.String stubPropertyName(java.lang.String fullyQualifiedName)
Returns a stub property name from full class name by stripping away the package and decapitalizing the name For example will returnfooBarforcom.foo.bar.baz.FooBarclass name- Parameters:
fullyQualifiedName- fully qualified class name, such as com.foo.bar.baz.FooBar- Returns:
- stup property name, such as fooBar
-
extractParts
static java.lang.Iterable<java.lang.String> extractParts(java.lang.String name)
It removes the dots from the name and creates anIterablefrom them. E.q. for the nameprops.fontit will return anIterablecontaining thepropsandfont- Parameters:
name- the name that needs to be parsed into parts- Returns:
- an
Iterablecontaining all the parts of the name.
-
getMostSimilarWord
public static java.lang.String getMostSimilarWord(java.lang.String word, java.util.Collection<java.lang.String> similarWords)
-
levenshteinDistance
private static int levenshteinDistance(java.lang.String s, java.lang.String t)
-
-