public class Strings extends Object
Modifier and Type | Method and Description |
---|---|
static String |
capitalize(String string) |
static String |
decapitalize(String string) |
static String |
getMostSimilarWord(String word,
Collection<String> similarWords) |
static String |
getSafeVariableName(String name,
Collection<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 String |
getSafeVariableName(String name,
String... existingVariableNames) |
static boolean |
isEmpty(String string) |
static boolean |
isNotEmpty(String string) |
static String |
join(Iterable<?> iterable,
String separator) |
static <T> String |
join(Iterable<T> iterable,
String separator,
Extractor<T,String> extractor) |
static String |
joinAndCamelize(Iterable<?> iterable) |
static String |
sanitizeIdentifierName(String identifier) |
static String |
stubPropertyName(String fullyQualifiedName)
Returns a stub property name from full class name by stripping away the package and decapitalizing the name
For example will return
fooBar for com.foo.bar.baz.FooBar class name |
public static <T> String join(Iterable<T> iterable, String separator, Extractor<T,String> extractor)
public static boolean isEmpty(String string)
public static boolean isNotEmpty(String string)
public static String getSafeVariableName(String name, String... existingVariableNames)
public static String getSafeVariableName(String name, Collection<String> existingVariableNames)
name
- the name to get a safe version forexistingVariableNames
- the names of other variables existing in the same scopepublic static String sanitizeIdentifierName(String identifier)
identifier
- identifier to sanitizepublic static String stubPropertyName(String fullyQualifiedName)
fooBar
for com.foo.bar.baz.FooBar
class namefullyQualifiedName
- fully qualified class name, such as com.foo.bar.baz.FooBarpublic static String getMostSimilarWord(String word, Collection<String> similarWords)
Copyright © 2012-2021 MapStruct Authors; All rights reserved. Released under the Apache Software License 2.0.