Class Utils
java.lang.Object
com.github.javaparser.utils.Utils
Any kind of utility.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic StringassertNonEmpty(String string) static <T extends Number>
TassertNonNegative(T number) static <T> TassertNotNull(T o) static <T extends Number>
TassertPositive(T number) static StringcamelCaseToScreaming(String input) static Stringcapitalize(String s) Capitalizes the first character in the string.static StringLower-cases the first character in the string.static StringescapeEndOfLines(String string) static booleanChecks, if the parent is a unary expression with a minus operator.static StringBuilderindent(StringBuilder builder, int indentLevel) Make an indent by appending indentLevel tab characters to the builder.static <E> intindexOfElementByObjectIdentity(List<E> list, E o) LikeList.indexOf(Object), but using ==, not equals.static <E> booleanisNullOrEmpty(Collection<E> collection) static StringReturn the next word of the string, in other words it stops when a space is encountered.static StringnormalizeEolInTextBlock(String content, LineSeparator desiredEndOfLineCharacter) static StringnormalizeEolInTextBlock(String content, String desiredEndOfLineCharacter) static StringreaderToString(Reader reader) static <E> voidremoveElementByObjectIdentity(List<E> list, E o) LikeList.remove(Object), but using ==, not equals.static StringremoveFileExtension(String filename) static <E> voidreplaceElementByObjectIdentity(List<E> list, E oldObject, E newObject) LikeList.set(int, Object)atList.indexOf(Object), but using ==, not equals.static StringscreamingToCamelCase(String original) Transform a string to the camel case conversion.static <T> Set<T> set(T... items) private static Stringstatic StringtoCamelCase(String original) Deprecated.use screamingToCamelCasestatic StringtrimTrailingSpaces(String line) LikeString.trim(), but only the trailing spaces.static booleanvalueIsNullOrEmpty(Object value) static boolean
-
Constructor Details
-
Utils
public Utils()
-
-
Method Details
-
isNullOrEmpty
-
assertNotNull
public static <T> T assertNotNull(T o) -
assertNonEmpty
-
assertNonNegative
-
assertPositive
-
escapeEndOfLines
-
readerToString
- Throws:
IOException
-
toCamelCase
Deprecated.use screamingToCamelCase -
screamingToCamelCase
-
camelCaseToScreaming
-
nextWord
-
indent
Make an indent by appending indentLevel tab characters to the builder. -
capitalize
-
decapitalize
-
stringTransformer
-
valueIsNullOrEmpty
- Returns:
- true if the value is null, an empty Optional, or an empty String.
-
valueIsNullOrEmptyStringOrOptional
-
replaceElementByObjectIdentity
LikeList.set(int, Object)atList.indexOf(Object), but using ==, not equals. -
removeElementByObjectIdentity
LikeList.remove(Object), but using ==, not equals. -
indexOfElementByObjectIdentity
LikeList.indexOf(Object), but using ==, not equals. -
set
- Returns:
- a set of the items.
-
normalizeEolInTextBlock
-
normalizeEolInTextBlock
public static String normalizeEolInTextBlock(String content, LineSeparator desiredEndOfLineCharacter) - Returns:
- content, with all kinds of EOL characters replaced by desiredEndOfLineCharacter
-
removeFileExtension
-
trimTrailingSpaces
LikeString.trim(), but only the trailing spaces. -
hasUnaryMinusAsParent
Checks, if the parent is a unary expression with a minus operator. Used to check for negative literals.
-