Class NameValidator
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
static class
static enum
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic boolean
isLegalNamespaceName
(String name) static boolean
isLegalNamespaceName
(String name, Function<String, String> replaceCustom) static boolean
Validates whether a givenname
is a valid namespace.static boolean
isLegalNamespaceName
(String name, Set<String> takenNames) static boolean
isLegalTableName
(String name) static boolean
isLegalTableName
(String name, Function<String, String> replaceCustom) static boolean
Validates whether a given name is a legal table name.static boolean
isLegalTableName
(String name, Set<String> takenNames) static boolean
isValidColumnName
(String name) static boolean
isValidNamespaceName
(String name) static boolean
isValidPartitionName
(String name) static boolean
static boolean
isValidTableName
(String name) static String
legalizeColumnName
(String name) static String
legalizeColumnName
(String name, Function<String, String> replaceCustom) static String
Attempts to return a legal name based on the passed inname
.static String
legalizeColumnName
(String name, Set<String> takenNames) static String[]
legalizeColumnNames
(String[] names) static String[]
legalizeColumnNames
(String[] names, boolean resolveConflicts) static String[]
legalizeColumnNames
(String[] names, Function<String, String> customReplace) static String[]
legalizeColumnNames
(String[] names, Function<String, String> customReplace, boolean resolveConflicts) static String
legalizeNamespaceName
(String name) static String
legalizeNamespaceName
(String name, Function<String, String> replaceCustom) static String
Attempts to return a legal name based on the passed inname
.static String
legalizeNamespaceName
(String name, Set<String> takenNames) static String[]
legalizeNamespaceNames
(String[] names) static String[]
legalizeNamespaceNames
(String[] names, boolean resolveConflicts) static String[]
legalizeNamespaceNames
(String[] names, Function<String, String> customReplace) static String[]
legalizeNamespaceNames
(String[] names, Function<String, String> customReplace, boolean resolveConflicts) static String
static String
legalizeQueryParameterName
(String name, Function<String, String> replaceCustom) static String
legalizeQueryParameterName
(String name, Function<String, String> customReplace, Set<String> takenNames) Attempts to return a legal name based on the passed inname
.static String
legalizeQueryParameterName
(String name, Set<String> takenNames) static String[]
legalizeQueryParameterNames
(String[] names) static String[]
legalizeQueryParameterNames
(String[] names, boolean resolveConflicts) static String[]
legalizeQueryParameterNames
(String[] names, Function<String, String> customReplace) static String[]
legalizeQueryParameterNames
(String[] names, Function<String, String> customReplace, boolean resolveConflicts) static String
legalizeTableName
(String name) static String
legalizeTableName
(String name, Function<String, String> replaceCustom) static String
Attempts to return a legal name based on the passed inname
.static String
legalizeTableName
(String name, Set<String> takenNames) static String[]
legalizeTableNames
(String[] names) static String[]
legalizeTableNames
(String[] names, boolean resolveConflicts) static String[]
legalizeTableNames
(String[] names, Function<String, String> customReplace) static String[]
legalizeTableNames
(String[] names, Function<String, String> customReplace, boolean resolveConflicts) static String
validateColumnName
(String name) static String
validateNamespaceName
(String name) static String
validatePartitionName
(String name) static String
static String
validateTableName
(String name)
-
Constructor Details
-
NameValidator
public NameValidator()
-
-
Method Details
-
validateTableName
-
isValidTableName
-
validateNamespaceName
-
isValidNamespaceName
-
validatePartitionName
-
isValidPartitionName
-
validateQueryParameterName
-
isValidQueryParameterName
-
validateColumnName
-
isValidColumnName
-
legalizeColumnName
-
legalizeColumnName
-
legalizeColumnName
-
legalizeColumnName
public static String legalizeColumnName(String name, Function<String, String> customReplace, Set<String> takenNames) Attempts to return a legal name based on the passed inname
.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
-
legalizeColumnNames
-
legalizeColumnNames
-
legalizeColumnNames
-
legalizeQueryParameterName
-
legalizeQueryParameterName
-
legalizeQueryParameterName
-
legalizeQueryParameterName
public static String legalizeQueryParameterName(String name, Function<String, String> customReplace, Set<String> takenNames) Attempts to return a legal name based on the passed inname
.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
-
legalizeQueryParameterNames
-
legalizeQueryParameterNames
-
legalizeQueryParameterNames
-
legalizeTableName
-
legalizeTableName
-
legalizeTableName
-
legalizeTableName
public static String legalizeTableName(String name, Function<String, String> customReplace, Set<String> takenNames) Attempts to return a legal name based on the passed inname
.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
-
isLegalTableName
-
isLegalTableName
-
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 validatecustomReplace
- a function that is applied to the name before processing legalitytakenNames
- the list of names that are already taken- Returns:
- whether the name is valid for a new table
-
legalizeTableNames
-
legalizeTableNames
-
legalizeTableNames
-
legalizeTableNames
-
legalizeNamespaceName
-
legalizeNamespaceName
-
legalizeNamespaceName
-
legalizeNamespaceName
public static String legalizeNamespaceName(String name, Function<String, String> customReplace, Set<String> takenNames) Attempts to return a legal name based on the passed inname
.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 givenname
is a valid namespace.- Parameters:
name
- the name to validatecustomReplace
- a function that is applied to the name before processing legalitytakenNames
- the list of names that are already taken- Returns:
- whether the name is valid for a new namespace
-
isLegalNamespaceName
-
isLegalNamespaceName
-
isLegalNamespaceName
-
legalizeNamespaceNames
-
legalizeNamespaceNames
-
legalizeNamespaceNames
-
legalizeNamespaceNames
-