Class NameValidator

java.lang.Object
io.deephaven.api.util.NameValidator

public class NameValidator extends Object
  • Constructor Details

    • NameValidator

      public NameValidator()
  • Method Details

    • validateTableName

      public static String validateTableName(String name)
    • isValidTableName

      public static boolean isValidTableName(String name)
    • validateNamespaceName

      public static String validateNamespaceName(String name)
    • isValidNamespaceName

      public static boolean isValidNamespaceName(String name)
    • validatePartitionName

      public static String validatePartitionName(String name)
    • isValidPartitionName

      public static boolean isValidPartitionName(String name)
    • validateQueryParameterName

      public static String validateQueryParameterName(String name)
    • isValidQueryParameterName

      public static boolean isValidQueryParameterName(String name)
    • validateColumnName

      public static String validateColumnName(String name)
    • isValidColumnName

      public static boolean isValidColumnName(String name)
    • legalizeColumnName

      public static String legalizeColumnName(String name)
    • legalizeColumnName

      public static String legalizeColumnName(String name, Set<String> takenNames)
    • legalizeColumnName

      public static String legalizeColumnName(String name, Function<String,String> replaceCustom)
    • legalizeColumnName

      public static String legalizeColumnName(String name, Function<String,String> customReplace, Set<String> takenNames)
      Attempts to return a legal name based on the passed in name.

      Illegal characters are simply removed. Custom replacement is possible through customReplace

      To avoid duplicated names, anything in the set takenNames will not be returned. These duplicates are resolved by adding sequential digits at the end of the variable name.

      Column names A variable's name can be any legal identifier - an unlimited-length sequence of Unicode letters and digits, beginning with a letter, the dollar sign "$", or the underscore character "_". Subsequent characters may be letters, digits, dollar signs, or underscore characters.

      Parameters:
      name - , customReplace, takenNames can not be null
      Returns:
    • legalizeColumnNames

      public static String[] legalizeColumnNames(String[] names)
    • legalizeColumnNames

      public static String[] legalizeColumnNames(String[] names, Function<String,String> customReplace)
    • legalizeColumnNames

      public static String[] legalizeColumnNames(String[] names, boolean resolveConflicts)
    • legalizeColumnNames

      public static String[] legalizeColumnNames(String[] names, Function<String,String> customReplace, boolean resolveConflicts)
    • legalizeQueryParameterName

      public static String legalizeQueryParameterName(String name)
    • legalizeQueryParameterName

      public static String legalizeQueryParameterName(String name, Function<String,String> replaceCustom)
    • legalizeQueryParameterName

      public static String legalizeQueryParameterName(String name, Set<String> takenNames)
    • legalizeQueryParameterName

      public static String legalizeQueryParameterName(String name, Function<String,String> customReplace, Set<String> takenNames)
      Attempts to return a legal name based on the passed in name.

      Illegal characters are simply removed. Custom replacement is possible through customReplace

      To avoid duplicated names, anything in the set takenNames will not be returned. These duplicates are resolved by adding sequential digits at the end of the variable name.

      Query parameters follow the same rules as column names

      Parameters:
      name - , customReplace, takenNames can not be null
      Returns:
    • legalizeQueryParameterNames

      public static String[] legalizeQueryParameterNames(String[] names)
    • legalizeQueryParameterNames

      public static String[] legalizeQueryParameterNames(String[] names, Function<String,String> customReplace)
    • legalizeQueryParameterNames

      public static String[] legalizeQueryParameterNames(String[] names, boolean resolveConflicts)
    • legalizeQueryParameterNames

      public static String[] legalizeQueryParameterNames(String[] names, Function<String,String> customReplace, boolean resolveConflicts)
    • legalizeTableName

      public static String legalizeTableName(String name)
    • legalizeTableName

      public static String legalizeTableName(String name, Set<String> takenNames)
    • legalizeTableName

      public static String legalizeTableName(String name, Function<String,String> replaceCustom)
    • legalizeTableName

      public static String legalizeTableName(String name, Function<String,String> customReplace, Set<String> takenNames)
      Attempts to return a legal name based on the passed in name.

      Illegal characters are simply removed. Custom replacement is possible through customReplace

      To avoid duplicated names, anything in the set takenNames will not be returned. These duplicates are resolved by adding sequential digits at the end of the variable name.

      Table Names- check the regex TABLE_NAME_PATTERN

      Parameters:
      name - , customReplace, takenNames can not be null
      Returns:
    • isLegalTableName

      public static boolean isLegalTableName(String name)
    • isLegalTableName

      public static boolean isLegalTableName(String name, Set<String> takenNames)
    • isLegalTableName

      public static boolean isLegalTableName(String name, Function<String,String> replaceCustom)
    • isLegalTableName

      public static boolean isLegalTableName(String name, Function<String,String> customReplace, Set<String> takenNames)
      Validates whether a given name is a legal table name.
      Parameters:
      name - the name to validate
      customReplace - a function that is applied to the name before processing legality
      takenNames - the list of names that are already taken
      Returns:
      whether the name is valid for a new table
    • legalizeTableNames

      public static String[] legalizeTableNames(String[] names)
    • legalizeTableNames

      public static String[] legalizeTableNames(String[] names, Function<String,String> customReplace)
    • legalizeTableNames

      public static String[] legalizeTableNames(String[] names, boolean resolveConflicts)
    • legalizeTableNames

      public static String[] legalizeTableNames(String[] names, Function<String,String> customReplace, boolean resolveConflicts)
    • legalizeNamespaceName

      public static String legalizeNamespaceName(String name)
    • legalizeNamespaceName

      public static String legalizeNamespaceName(String name, Set<String> takenNames)
    • legalizeNamespaceName

      public static String legalizeNamespaceName(String name, Function<String,String> replaceCustom)
    • legalizeNamespaceName

      public static String legalizeNamespaceName(String name, Function<String,String> customReplace, Set<String> takenNames)
      Attempts to return a legal name based on the passed in name.

      Illegal characters are simply removed. Custom replacement is possible through customReplace

      To avoid duplicated names, anything in the set takenNames will not be returned. These duplicates are resolved by adding sequential digits at the end of the variable name.

      Namespace Names- check the regex TABLE_NAME_PATTERN

      Parameters:
      name - , customReplace, takenNames can not be null
      Returns:
    • isLegalNamespaceName

      public static boolean isLegalNamespaceName(String name, Function<String,String> customReplace, Set<String> takenNames)
      Validates whether a given name is a valid namespace.
      Parameters:
      name - the name to validate
      customReplace - a function that is applied to the name before processing legality
      takenNames - the list of names that are already taken
      Returns:
      whether the name is valid for a new namespace
    • isLegalNamespaceName

      public static boolean isLegalNamespaceName(String name)
    • isLegalNamespaceName

      public static boolean isLegalNamespaceName(String name, Set<String> takenNames)
    • isLegalNamespaceName

      public static boolean isLegalNamespaceName(String name, Function<String,String> replaceCustom)
    • legalizeNamespaceNames

      public static String[] legalizeNamespaceNames(String[] names)
    • legalizeNamespaceNames

      public static String[] legalizeNamespaceNames(String[] names, Function<String,String> customReplace)
    • legalizeNamespaceNames

      public static String[] legalizeNamespaceNames(String[] names, boolean resolveConflicts)
    • legalizeNamespaceNames

      public static String[] legalizeNamespaceNames(String[] names, Function<String,String> customReplace, boolean resolveConflicts)