Class StringUtils

java.lang.Object
com.atlan.util.StringUtils

public final class StringUtils extends Object
Utilities for working with strings.
  • Constructor Details

    • StringUtils

      public StringUtils()
  • Method Details

    • containsWhitespace

      public static boolean containsWhitespace(String str)
      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

      public static boolean secureCompare(String a, String b)
      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

      public 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.
      Parameters:
      methodName - from which to reverse-engineer the field name
      Returns:
      the field name
    • encodeContent

      public static String encodeContent(String decoded)
      Encode the provided content for storage as a README's content.
      Parameters:
      decoded - to be encoded
      Returns:
      encoded README content
    • decodeContent

      public static String decodeContent(String encoded)
      Decode the provided content from the README-encoded form to plain HTML.
      Parameters:
      encoded - to be decoded
      Returns:
      decoded README content (HTML)
    • getConnectionQualifiedName

      public static String getConnectionQualifiedName(String qualifiedName)
      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

      public static String getSuperDomainQualifiedName(String domainQualifiedName)
      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

      public static String getNameFromQualifiedName(String qualifiedName)
      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

      public static String getNameFromQualifiedName(String qualifiedName, String delimiter)
      Retrieve the name of a data asset from the provided qualifiedName.
      Parameters:
      qualifiedName - from which to retrieve the name component
      delimiter - by which the (non-connection) components of the qualifiedName are separated
      Returns:
      the name of the data asset
    • getParentQualifiedNameFromQualifiedName

      public static String getParentQualifiedNameFromQualifiedName(String qualifiedName)
      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 qualifiedName
      delimiter - by which the (non-connection) components of the qualifiedName are separated
      Returns:
      the qualifiedName of the parent data asset
    • trimPathDelimiters

      public static String trimPathDelimiters(String toTrim)
      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

      public static boolean isUUID(String str)
      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

      public static String getUpperCamelCase(String text)
      Convert the provided string into UpperCamelCase.
      Parameters:
      text - to convert
      Returns:
      the original text, in UpperCamelCase
    • getLowerCamelCase

      public static String getLowerCamelCase(String text)
      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

      public static String getLowerCamelCaseAggressive(String text)
      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

      public static String getUpperSnakeCase(String text)
      Convert the provided string to UPPER_SNAKE_CASE.
      Parameters:
      text - to convert
      Returns:
      the original text, in UPPER_SNAKE_CASE
    • getLowerSnakeCase

      public static String getLowerSnakeCase(String text)
      Convert the provided string to lower_snake_case.
      Parameters:
      text - to convert
      Returns:
      the original text, in lower_snake_case
    • getTitleCase

      public static String getTitleCase(String text)
      Convert the provided string to Title Case.
      Parameters:
      text - to convert
      Returns:
      the original text, in Title Case