Class Identifier
- java.lang.Object
-
- com.snowflake.connectors.common.object.Identifier
-
public class Identifier extends Object
Representation of a Snowflake object identifier.An
Identifier
object can be a representation of:- an unquoted object identifier
- a quoted object identifier
Read more about object identifiers at Snowflake here and here.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
Identifier.AutoQuoting
Setting for auto quoting on identifier instance creation.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
equals(Object o)
static Identifier
from(String identifier)
Creates a new identifier instance from the provided String, without any additional quoting.static Identifier
from(String identifier, Identifier.AutoQuoting autoQuoting)
Creates a new identifier instance from the provided String, with possible additional auto quoting if enabled.String
getQuotedValue()
Returns the identifier value in a quoted form.String
getUnquotedValue()
Returns the identifier value in an unquoted form.String
getValue()
Returns the identifier value.Variant
getVariantValue()
Returns the identifier value wrapped in a Snowpark Variant object.int
hashCode()
boolean
isQuoted()
Returns whether the identifier is quoted.static boolean
isQuoted(String identifier)
Returns whether the provided String is a valid quoted identifier.boolean
isUnquoted()
Returns whether the identifier is unquoted.static boolean
isUnquoted(String identifier)
Returns whether the provided String is a valid unquoted identifier.static boolean
isValid(String identifier)
Returns whether the provided String matches is a valid identifier.String
toString()
-
-
-
Method Detail
-
from
public static Identifier from(String identifier)
Creates a new identifier instance from the provided String, without any additional quoting.- Parameters:
identifier
- identifier String- Returns:
- new identifier instance
- Throws:
InvalidIdentifierException
- if an invalid or null identifier is provided
-
from
public static Identifier from(String identifier, Identifier.AutoQuoting autoQuoting)
Creates a new identifier instance from the provided String, with possible additional auto quoting if enabled.- Parameters:
identifier
- identifier StringautoQuoting
- whether auto quoting should be used- Returns:
- new identifier instance
-
isValid
public static boolean isValid(String identifier)
Returns whether the provided String matches is a valid identifier.- Parameters:
identifier
- String to check- Returns:
- whether the provided String is a valid identifier
-
isUnquoted
public static boolean isUnquoted(String identifier)
Returns whether the provided String is a valid unquoted identifier.- Parameters:
identifier
- String to check- Returns:
- whether the provided String is a valid unquoted identifier
-
isQuoted
public static boolean isQuoted(String identifier)
Returns whether the provided String is a valid quoted identifier.- Parameters:
identifier
- String to check- Returns:
- whether the provided String is a valid quoted identifier
-
getValue
public String getValue()
Returns the identifier value.Returned value is ready to use in any SQL queries, no additional quoting or character escaping is required.
- Returns:
- identifier value
-
getUnquotedValue
public String getUnquotedValue()
Returns the identifier value in an unquoted form.If the identifier value is already unquoted - it is returned without any changes.
Otherwise unescapes any double quote characters in the identifier value (by replacing doubled characters with single ones) and unwraps the resulting String from double quotes.
- Returns:
- unquoted identifier value
-
getQuotedValue
public String getQuotedValue()
Returns the identifier value in a quoted form.If the identifier value is already quoted - it is returned without any changes.
Otherwise escapes any double quote characters in the identifier value (by doubling them) and wraps the resulting String is double quotes.
- Returns:
- unquoted identifier value
-
getVariantValue
public Variant getVariantValue()
Returns the identifier value wrapped in a Snowpark Variant object.- Returns:
- identifier value in a Variant
-
isUnquoted
public boolean isUnquoted()
Returns whether the identifier is unquoted.- Returns:
- whether the identifier is unquoted
-
isQuoted
public boolean isQuoted()
Returns whether the identifier is quoted.- Returns:
- whether the identifier is quoted
-
-