@Immutable public class CqlIdentifier extends Object implements Serializable
It has two representations:
"").
| Create statement | Case-sensitive? | CQL id | Internal id |
|---|---|---|---|
| CREATE TABLE t(foo int PRIMARY KEY) | No | foo | foo |
| CREATE TABLE t(Foo int PRIMARY KEY) | No | foo | foo |
| CREATE TABLE t("Foo" int PRIMARY KEY) | Yes | "Foo" | Foo |
| CREATE TABLE t("foo bar" int PRIMARY KEY) | Yes | "foo bar" | foo bar |
| CREATE TABLE t("foo""bar" int PRIMARY KEY) | Yes | "foo""bar" | foo"bar |
| CREATE TABLE t("create" int PRIMARY KEY) | Yes (reserved keyword) | "create" | create |
fromCql(String).
There is no internal caching; if you reuse the same identifiers often, consider caching them in your application.
| Modifier and Type | Method and Description |
|---|---|
String |
asCql(boolean pretty)
Returns the identifier in a format appropriate for concatenation in a CQL query.
|
String |
asInternal()
Returns the identifier in the "internal" format.
|
boolean |
equals(Object other) |
static CqlIdentifier |
fromCql(String cql)
Creates an identifier from its
CQL form. |
static CqlIdentifier |
fromInternal(String internal)
Creates an identifier from its
internal form. |
int |
hashCode() |
String |
toString() |
@NonNull public static CqlIdentifier fromCql(@NonNull String cql)
CQL form.@NonNull public static CqlIdentifier fromInternal(@NonNull String internal)
internal form.@NonNull public String asInternal()
@NonNull public String asCql(boolean pretty)
pretty - if true, use the shortest possible representation: if the identifier is
case-insensitive, an unquoted, lower-case string, otherwise the double-quoted form. If
false, always use the double-quoted form (this is slightly more efficient since we
don't need to inspect the string).Copyright © 2017–2023. All rights reserved.