public final class GeneratorUtils extends Object
| Modifier and Type | Method and Description |
|---|---|
static String |
capitalize(String s)
Capitalizes the string.
|
static int |
compare(String s1,
String s2)
Compares two strings lexicographically.
|
static boolean |
contains(String s,
String p)
Checks if the string s contains string p with an additional check for
them to not be blank.
|
static String |
firstNonBlank(String... values)
Searches a first non-blank string in the received arguments.
|
static boolean |
hasAnnotation(com.github.javaparser.ast.nodeTypes.NodeWithAnnotations<?> declaration,
com.github.javaparser.ast.CompilationUnit compilationUnit,
Class<? extends Annotation> annotation)
Checks whether the declaration has the specific annotation.
|
static boolean |
isBlank(String s)
Checks if the string contains only whitespaces.
|
static boolean |
isNotBlank(String s)
Checks if the string contains not only whitespaces.
|
static boolean |
isNotTrue(Boolean b)
Checks a value for being not truth (or null).
|
static boolean |
isTrue(Boolean b)
Checks a value for being true with an additional null check.
|
static String |
removeEnd(String s,
String p)
Removes the end of a string.
|
static String |
replaceChars(String s,
char c1,
char c2)
Replaces one char with another in a string with an additional null check.
|
static String |
substringAfter(String s,
String p)
Gets the substring of an s string that goes after the first entry of the
p string.
|
static String |
substringAfterLast(String s,
String p)
Gets the substring of an s string that goes after the last entry of the p
string.
|
static String |
substringBeforeLast(String s,
String p)
Gets the substring of an s string that goes before the last entry of the
p string.
|
static <P1,P2,R> Stream<R> |
zip(List<P1> first,
List<P2> second,
BiFunction<P1,P2,R> zipper)
Runs a lambda against elements of two lists at once.
|
public static String capitalize(String s)
s - string to capitalize.public static int compare(String s1, String s2)
s1 - first string.s2 - second string.String.compareTo(java.lang.String)public static boolean contains(String s, String p)
s - a string where search to be performed.p - a string to be used for search.public static String firstNonBlank(String... values)
values - a vararg array to search within.public static boolean hasAnnotation(com.github.javaparser.ast.nodeTypes.NodeWithAnnotations<?> declaration,
com.github.javaparser.ast.CompilationUnit compilationUnit,
Class<? extends Annotation> annotation)
declaration - a declaration that is checked to have an annotation.compilationUnit - a compilation unit.annotation - an annotation to check.public static boolean isBlank(String s)
s - a string to check.public static boolean isNotBlank(String s)
s - a string to check.public static boolean isNotTrue(Boolean b)
b - a boolean to check.public static boolean isTrue(Boolean b)
b - a boolean to check for truth.public static String removeEnd(String s, String p)
s - a string to remove an end.p - an end part of a string.public static String replaceChars(String s, char c1, char c2)
s - a string to perform replace within.c1 - a char to be replaced.c2 - a char to be replacement.public static String substringAfter(String s, String p)
s - a string to get substring of.p - a string to be searched.public static String substringAfterLast(String s, String p)
s - a string to get substring of.p - a string to be searched.public static String substringBeforeLast(String s, String p)
s - a string to get substring of.p - a string to be searched.public static <P1,P2,R> Stream<R> zip(List<P1> first, List<P2> second, BiFunction<P1,P2,R> zipper)
P1 - a type of item of a first list.P2 - a type of item of a second list.R - a type of the streamed result.first - a first list.second - a second list.zipper - a lambda function that accepts elements from both lists at
once.Copyright © 2000–2022 Vaadin Ltd. All rights reserved.