Package com.atlan.util
Class StringUtils
java.lang.Object
com.atlan.util.StringUtils
Utilities for working with strings.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic boolean
containsWhitespace
(String str) Checks whether a string contains any whitespace characters or not.static String
decodeContent
(String encoded) Decode the provided content from the README-encoded form to plain HTML.static String
encodeContent
(String decoded) Encode the provided content for storage as a README's content.static String
getConnectionQualifiedName
(String qualifiedName) Retrieve the connection's qualifiedName from the provided asset qualifiedName.static String
getFieldNameFromMethodName
(String methodName) Determine the name of a field that's read or written by a getter/setter method, from the name of the method.static String
getLowerCamelCase
(String text) Convert the provided string to lowerCamelCase, leaving alone consecutive capital letters.static String
Convert the provided string to lowerCamelCase, aggressively lowercasing consecutive capital letters.static String
getLowerSnakeCase
(String text) Convert the provided string to lower_snake_case.static String
getNameFromQualifiedName
(String qualifiedName) Retrieve the name of a data asset from the provided qualifiedName.static String
getNameFromQualifiedName
(String qualifiedName, String delimiter) Retrieve the name of a data asset from the provided qualifiedName.static String
getParentQualifiedNameFromQualifiedName
(String qualifiedName) Retrieve the qualifiedName of the parent data asset of the provided asset's qualifiedName.static String
getParentQualifiedNameFromQualifiedName
(String qualifiedName, String delimiter) Retrieve the qualifiedName of the parent data asset of the provided asset's qualifiedName.static String
getSuperDomainQualifiedName
(String domainQualifiedName) Retrieve the domain's top-most ancestral domain qualifiedName.static String
getTitleCase
(String text) Convert the provided string to Title Case.static String
getUpperCamelCase
(String text) Convert the provided string into UpperCamelCase.static String
getUpperSnakeCase
(String text) Convert the provided string to UPPER_SNAKE_CASE.static boolean
Checks whether a string is a valid UUID(v4) or not.static boolean
secureCompare
(String a, String b) Compares two strings for equality.static String
trimPathDelimiters
(String toTrim) Remove any leading and trailing /-slashes from the provided string.
-
Constructor Details
-
StringUtils
public StringUtils()
-
-
Method Details
-
containsWhitespace
Checks whether a string contains any whitespace characters or not.- Parameters:
str
- the string to check.- Returns:
true
if the string contains any whitespace characters; otherwise,false
.
-
secureCompare
Compares two strings for equality. The time taken is independent of the number of characters that match.- Parameters:
a
- one of the strings to compare.b
- the other string to compare.- Returns:
- true if the strings are equal, false otherwise.
-
getFieldNameFromMethodName
Determine the name of a field that's read or written by a getter/setter method, from the name of the method.- Parameters:
methodName
- from which to reverse-engineer the field name- Returns:
- the field name
-
encodeContent
Encode the provided content for storage as a README's content.- Parameters:
decoded
- to be encoded- Returns:
- encoded README content
-
decodeContent
Decode the provided content from the README-encoded form to plain HTML.- Parameters:
encoded
- to be decoded- Returns:
- decoded README content (HTML)
-
getConnectionQualifiedName
Retrieve the connection's qualifiedName from the provided asset qualifiedName. Note that this will also return null if the qualifiedName provided is for a connection (only) already!- Parameters:
qualifiedName
- of the asset, from which to retrieve the connection's qualifiedName- Returns:
- the qualifiedName of the connection, or null if none can be determined
-
getSuperDomainQualifiedName
Retrieve the domain's top-most ancestral domain qualifiedName.- Parameters:
domainQualifiedName
- of the domain, from which to retrieve the top-most ancestral domain qualifiedName- Returns:
- the qualifiedName of the top-most ancestral domain, or null if none can be determined
-
getNameFromQualifiedName
Retrieve the name of a data asset from the provided qualifiedName.- Parameters:
qualifiedName
- from which to retrieve the name component- Returns:
- the name of the data asset
-
getNameFromQualifiedName
Retrieve the name of a data asset from the provided qualifiedName.- Parameters:
qualifiedName
- from which to retrieve the name componentdelimiter
- by which the (non-connection) components of the qualifiedName are separated- Returns:
- the name of the data asset
-
getParentQualifiedNameFromQualifiedName
Retrieve the qualifiedName of the parent data asset of the provided asset's qualifiedName.- Parameters:
qualifiedName
- from which to retrieve the parent asset's qualifiedName- Returns:
- the qualifiedName of the parent data asset
-
getParentQualifiedNameFromQualifiedName
public static String getParentQualifiedNameFromQualifiedName(String qualifiedName, String delimiter) Retrieve the qualifiedName of the parent data asset of the provided asset's qualifiedName.- Parameters:
qualifiedName
- from which to retrieve the parent asset's qualifiedNamedelimiter
- by which the (non-connection) components of the qualifiedName are separated- Returns:
- the qualifiedName of the parent data asset
-
trimPathDelimiters
Remove any leading and trailing /-slashes from the provided string.- Parameters:
toTrim
- the string to trim- Returns:
- the string, without any leading or trailing / (if any)
-
isUUID
Checks whether a string is a valid UUID(v4) or not.- Parameters:
str
- the string to check.- Returns:
true
if the string is a valid UUID(v4); otherwise,false
.
-
getUpperCamelCase
Convert the provided string into UpperCamelCase.- Parameters:
text
- to convert- Returns:
- the original text, in UpperCamelCase
-
getLowerCamelCase
Convert the provided string to lowerCamelCase, leaving alone consecutive capital letters. For example: "MySQLDatabase" turns into "mySQLDatabase"- Parameters:
text
- to convert- Returns:
- the original text, in lowerCamelCase
-
getLowerCamelCaseAggressive
Convert the provided string to lowerCamelCase, aggressively lowercasing consecutive capital letters. For example: "MySQLDatabase" turns into "mysqldatabase"- Parameters:
text
- to convert- Returns:
- the original text, in lowerCamelCase
-
getUpperSnakeCase
Convert the provided string to UPPER_SNAKE_CASE.- Parameters:
text
- to convert- Returns:
- the original text, in UPPER_SNAKE_CASE
-
getLowerSnakeCase
Convert the provided string to lower_snake_case.- Parameters:
text
- to convert- Returns:
- the original text, in lower_snake_case
-
getTitleCase
Convert the provided string to Title Case.- Parameters:
text
- to convert- Returns:
- the original text, in Title Case
-