本文整理了Java中com.datastax.driver.core.Metadata.handleId()
方法的一些代码示例,展示了Metadata.handleId()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Metadata.handleId()
方法的具体详情如下:
包路径:com.datastax.driver.core.Metadata
类名称:Metadata
方法名:handleId
暂无
代码示例来源:origin: com.datastax.cassandra/cassandra-driver-core
/**
* Returns the metadata for a table contained in this keyspace.
*
* @param name the name of table to retrieve
* @return the metadata for table {@code name} if it exists in this keyspace, {@code null}
* otherwise.
*/
public TableMetadata getTable(String name) {
return tables.get(Metadata.handleId(name));
}
代码示例来源:origin: com.datastax.cassandra/cassandra-driver-core
/**
* Returns metadata on a column of this table.
*
* @param name the name of the column to retrieve ({@code name} will be interpreted as a
* case-insensitive identifier unless enclosed in double-quotes, see {@link Metadata#quote}).
* @return the metadata for the column if it exists, or {@code null} otherwise.
*/
public ColumnMetadata getColumn(String name) {
return columns.get(Metadata.handleId(name));
}
代码示例来源:origin: com.datastax.cassandra/cassandra-driver-core
/**
* Returns the metadata for a materialized view contained in this keyspace.
*
* @param name the name of materialized view to retrieve
* @return the metadata for materialized view {@code name} if it exists in this keyspace, {@code
* null} otherwise.
*/
public MaterializedViewMetadata getMaterializedView(String name) {
return views.get(Metadata.handleId(name));
}
代码示例来源:origin: com.datastax.cassandra/cassandra-driver-core
/**
* Returns whether this UDT contains a given field.
*
* @param name the name to check. Note that {@code name} obey the usual CQL identifier rules: it
* should be quoted if it denotes a case sensitive identifier (you can use {@link
* Metadata#quote} for the quoting).
* @return {@code true} if this UDT contains a field named {@code name}, {@code false} otherwise.
*/
public boolean contains(String name) {
return byName.containsKey(Metadata.handleId(name));
}
代码示例来源:origin: com.datastax.cassandra/cassandra-driver-core
/**
* Returns the metadata of a keyspace given its name.
*
* @param keyspace the name of the keyspace for which metadata should be returned.
* @return the metadata of the requested keyspace or {@code null} if {@code keyspace} is not a
* known keyspace. Note that the result might be stale or null if metadata was explicitly
* disabled with {@link QueryOptions#setMetadataEnabled(boolean)}.
*/
public KeyspaceMetadata getKeyspace(String keyspace) {
return keyspaces.get(handleId(keyspace));
}
代码示例来源:origin: com.datastax.cassandra/cassandra-driver-core
/**
* Returns metadata on a index of this table.
*
* @param name the name of the index to retrieve ({@code name} will be interpreted as a
* case-insensitive identifier unless enclosed in double-quotes, see {@link Metadata#quote}).
* @return the metadata for the {@code name} index if it exists, or {@code null} otherwise.
*/
public IndexMetadata getIndex(String name) {
return indexes.get(Metadata.handleId(name));
}
代码示例来源:origin: com.datastax.cassandra/cassandra-driver-core
/**
* Returns metadata on a view of this table.
*
* @param name the name of the view to retrieve ({@code name} will be interpreted as a
* case-insensitive identifier unless enclosed in double-quotes, see {@link Metadata#quote}).
* @return the metadata for the {@code name} view if it exists, or {@code null} otherwise.
*/
public MaterializedViewMetadata getView(String name) {
return views.get(Metadata.handleId(name));
}
代码示例来源:origin: com.datastax.cassandra/cassandra-driver-core
/**
* Returns the definition for a user defined type (UDT) in this keyspace.
*
* @param name the name of UDT definition to retrieve
* @return the definition for {@code name} if it exists in this keyspace, {@code null} otherwise.
*/
public UserType getUserType(String name) {
return userTypes.get(Metadata.handleId(name));
}
代码示例来源:origin: com.datastax.cassandra/cassandra-driver-core
@Override
protected int[] getAllIndexesOf(String name) {
int[] indexes = definition.byName.get(Metadata.handleId(name));
if (indexes == null)
throw new IllegalArgumentException(name + " is not a field defined in this UDT");
return indexes;
}
代码示例来源:origin: com.datastax.cassandra/cassandra-driver-core
/**
* Returns the definition of an aggregate in this keyspace.
*
* @param name the name of the aggregate.
* @param argumentTypes the types of the aggregate's arguments.
* @return the aggregate definition if it exists in this keyspace, {@code null} otherwise.
*/
public AggregateMetadata getAggregate(String name, Collection<DataType> argumentTypes) {
return aggregates.get(Metadata.fullFunctionName(Metadata.handleId(name), argumentTypes));
}
代码示例来源:origin: com.datastax.cassandra/cassandra-driver-core
/**
* Returns the definition of a function in this keyspace.
*
* @param name the name of the function.
* @param argumentTypes the types of the function's arguments.
* @return the function definition if it exists in this keyspace, {@code null} otherwise.
*/
public FunctionMetadata getFunction(String name, Collection<DataType> argumentTypes) {
return functions.get(Metadata.fullFunctionName(Metadata.handleId(name), argumentTypes));
}
代码示例来源:origin: com.datastax.cassandra/cassandra-driver-core
@Test(groups = "unit")
public void handleId_should_unquote_and_preserve_case_of_quoted_identifiers() {
assertThat(Metadata.handleId("\"FooBar1\"")).isEqualTo("FooBar1");
assertThat(Metadata.handleId("\"Foo_Bar_1\"")).isEqualTo("Foo_Bar_1");
assertThat(Metadata.handleId("\"Foo Bar 1\"")).isEqualTo("Foo Bar 1");
}
代码示例来源:origin: com.datastax.cassandra/cassandra-driver-core
@Test(groups = "unit")
public void handleId_should_lowercase_unquoted_alphanumeric_identifiers() {
assertThat(Metadata.handleId("FooBar1")).isEqualTo("foobar1");
assertThat(Metadata.handleId("Foo_Bar_1")).isEqualTo("foo_bar_1");
assertThat(Metadata.handleId("foo_bar_1")).isEqualTo("foo_bar_1");
}
代码示例来源:origin: com.datastax.cassandra/cassandra-driver-core
@Test(groups = "unit")
public void handleId_should_preserve_unquoted_non_alphanumeric_identifiers() {
assertThat(Metadata.handleId("Foo Bar")).isEqualTo("Foo Bar");
}
代码示例来源:origin: com.datastax.cassandra/cassandra-driver-core
@Test(groups = "unit")
public void handleId_should_unescape_duplicate_double_quotes_in_quoted_identifiers() {
assertThat(Metadata.handleId("\"Foo\"\"Bar\"")).isEqualTo("Foo\"Bar");
}
代码示例来源:origin: com.datastax.cassandra/cassandra-driver-core
@SuppressWarnings("RedundantCast")
@Test(groups = "short", dataProvider = "existingKeyspaceName")
@CassandraVersion("2.1.0")
public void should_notify_of_udt_drop(String keyspace) {
session1.execute(String.format("CREATE TYPE %s.type1(i int)", keyspace));
session1.execute(String.format("DROP TYPE %s.type1", keyspace));
for (SchemaChangeListener listener : listeners) {
ArgumentCaptor<UserType> removed = ArgumentCaptor.forClass(UserType.class);
verify(listener, timeout(NOTIF_TIMEOUT_MS).times(1)).onUserTypeRemoved(removed.capture());
assertThat((DataType) removed.getValue()).isUserType(handleId(keyspace), "type1");
}
for (Metadata m : metadatas())
assertThat((DataType) m.getKeyspace(keyspace).getUserType("type1")).isNull();
}
代码示例来源:origin: com.datastax.cassandra/cassandra-driver-core
@SuppressWarnings("RedundantCast")
@Test(groups = "short", dataProvider = "existingKeyspaceName")
@CassandraVersion("2.1.0")
public void should_notify_of_udt_creation(String keyspace) {
session1.execute(String.format("CREATE TYPE %s.type1(i int)", keyspace));
for (SchemaChangeListener listener : listeners) {
ArgumentCaptor<UserType> added = ArgumentCaptor.forClass(UserType.class);
verify(listener, timeout(NOTIF_TIMEOUT_MS).times(1)).onUserTypeAdded(added.capture());
assertThat((DataType) added.getValue()).isUserType(handleId(keyspace), "type1");
}
for (Metadata m : metadatas())
assertThat((DataType) m.getKeyspace(keyspace).getUserType("type1")).isNotNull();
}
代码示例来源:origin: com.datastax.cassandra/cassandra-driver-core
@Test(groups = "short", dataProvider = "newKeyspaceName")
public void should_notify_of_keyspace_creation(String keyspace) throws InterruptedException {
execute(CREATE_KEYSPACE, keyspace);
for (SchemaChangeListener listener : listeners) {
ArgumentCaptor<KeyspaceMetadata> added = ArgumentCaptor.forClass(KeyspaceMetadata.class);
verify(listener, timeout(NOTIF_TIMEOUT_MS).times(1)).onKeyspaceAdded(added.capture());
assertThat(added.getValue()).hasName(handleId(keyspace));
}
for (Metadata m : metadatas()) assertThat(m.getKeyspace(keyspace)).isNotNull();
}
代码示例来源:origin: com.datastax.cassandra/cassandra-driver-core
@Test(groups = "short", dataProvider = "existingKeyspaceName")
public void should_notify_of_table_creation(String keyspace) throws InterruptedException {
execute(CREATE_TABLE, keyspace);
for (SchemaChangeListener listener : listeners) {
ArgumentCaptor<TableMetadata> added = ArgumentCaptor.forClass(TableMetadata.class);
verify(listener, timeout(NOTIF_TIMEOUT_MS).times(1)).onTableAdded(added.capture());
assertThat(added.getValue()).isInKeyspace(handleId(keyspace)).hasName("table1");
}
for (Metadata m : metadatas())
assertThat(m.getKeyspace(keyspace).getTable("table1")).isNotNull();
}
代码示例来源:origin: com.datastax.cassandra/cassandra-driver-core
@Test(groups = "short", dataProvider = "existingKeyspaceName")
@CassandraVersion("2.2.0")
public void should_notify_of_function_creation(String keyspace) {
session1.execute(
String.format(
"CREATE FUNCTION %s.\"ID\"(i int) RETURNS NULL ON NULL INPUT RETURNS int LANGUAGE java AS 'return i;'",
keyspace));
for (SchemaChangeListener listener : listeners) {
ArgumentCaptor<FunctionMetadata> added = ArgumentCaptor.forClass(FunctionMetadata.class);
verify(listener, timeout(NOTIF_TIMEOUT_MS).times(1)).onFunctionAdded(added.capture());
assertThat(added.getValue()).isInKeyspace(handleId(keyspace)).hasSignature("\"ID\"(int)");
}
for (Metadata m : metadatas())
assertThat(m.getKeyspace(keyspace).getFunction("\"ID\"", DataType.cint())).isNotNull();
}
内容来源于网络,如有侵权,请联系作者删除!