public final class Utils
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static com.fasterxml.jackson.databind.ObjectMapper |
OBJECT_MAPPER |
Modifier and Type | Method and Description |
---|---|
static java.lang.String |
capitalize(java.lang.String aString)
Capitalize a string.
|
static java.lang.String |
capitalizeString(java.lang.String aString) |
static void |
createDirIfAbsent(java.io.File dir)
Create directory if it is absent.
|
static void |
deleteDir(java.io.File dir)
Deletes a given directory recursively.
|
static java.lang.String |
getFileContent(java.lang.String filePath)
Get content of the file.
|
static boolean |
isBlank(java.lang.CharSequence cs)
Copy of org.apache.commons.lang3.StringUtils#isBlank(CharSequence)
|
static boolean |
isEmpty(java.util.Collection<?> collection)
Check if collection is empty.
|
static boolean |
isGraphqlOperation(java.lang.String typeDef)
Check whether the given type definition is either Query or Mutation or Subscription.
|
static boolean |
isNotBlank(java.lang.CharSequence cs)
Inverted copy of org.apache.commons.lang3.StringUtils.isBlank(CharSequence cs)
|
static java.lang.String |
replaceLeadingAtSign(java.lang.String value)
Replace leading annotation (@) sign
|
static boolean |
stringsEqualIgnoreSpaces(java.lang.String a,
java.lang.String b)
Check if strings are equal (consider blank strings equal to null)
|
static java.lang.String |
substringBetween(java.lang.String str,
java.lang.String open,
java.lang.String close)
Copy of org.apache.commons.lang3.StringUtils#substringBetween(String, String, String)
|
static java.lang.String |
uncapitalize(java.lang.String aString)
Uncapitalize a string.
|
static java.lang.String |
wrapString(java.lang.String str,
java.lang.String wrapWith)
Wrap string
|
static java.lang.String |
wrapString(java.lang.String str,
java.lang.String wrapStart,
java.lang.String wrapEnd)
Wrap string
|
public static final com.fasterxml.jackson.databind.ObjectMapper OBJECT_MAPPER
public static boolean isGraphqlOperation(java.lang.String typeDef)
typeDef
- type definition nametrue
if the given type definition is GraphQL operationpublic static java.lang.String capitalize(java.lang.String aString)
aString
- string to capitalizepublic static java.lang.String capitalizeString(java.lang.String aString)
public static java.lang.String uncapitalize(java.lang.String aString)
aString
- string to uncapitalizepublic static boolean isNotBlank(java.lang.CharSequence cs)
cs
- the CharSequence to check, may be nullfalse
if the CharSequence is null, empty or whitespace onlypublic static boolean isBlank(java.lang.CharSequence cs)
cs
- the CharSequence to check, may be nulltrue
if the CharSequence is null, empty or whitespace onlypublic static boolean stringsEqualIgnoreSpaces(java.lang.String a, java.lang.String b)
a
- a stringb
- a string to be compared with a
true
if strings are equalpublic static java.lang.String getFileContent(java.lang.String filePath) throws java.io.IOException
filePath
- path of the file.java.io.IOException
- unable to read the file.public static void deleteDir(java.io.File dir)
dir
- directory to deleteUnableToDeleteDirectoryException
- if unable to delete a directorypublic static void createDirIfAbsent(java.io.File dir)
dir
- to create if it is absent.UnableToCreateDirectoryException
- if unable to create a directorypublic static boolean isEmpty(java.util.Collection<?> collection)
collection
- that will be checked for emptinesspublic static java.lang.String replaceLeadingAtSign(java.lang.String value)
value
- annotation value with/without @ signpublic static java.lang.String substringBetween(java.lang.String str, java.lang.String open, java.lang.String close)
Gets the String that is nested in between two Strings. Only the first match is returned.
str
- the String containing the substring, may be nullopen
- the String before the substring, may be nullclose
- the String after the substring, may be nullnull
if no matchpublic static java.lang.String wrapString(java.lang.String str, java.lang.String wrapWith)
str
- the StringwrapWith
- String to be appended to the beginning and the end of strpublic static java.lang.String wrapString(java.lang.String str, java.lang.String wrapStart, java.lang.String wrapEnd)
str
- the StringwrapStart
- String to be appended to the beginning of strwrapEnd
- String to be appended to the end of str