com.datastax.driver.core.Row.get()方法的使用及代码示例

x33g5p2x  于2022-01-28 转载在 其他  
字(10.9k)|赞(0)|评价(0)|浏览(133)

本文整理了Java中com.datastax.driver.core.Row.get方法的一些代码示例,展示了Row.get的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Row.get方法的具体详情如下:
包路径:com.datastax.driver.core.Row
类名称:Row
方法名:get

Row.get介绍

[英]Returns the ith value of this row as a boolean.
[中]以布尔值形式返回此行的第i个值。

代码示例

代码示例来源:origin: com.datastax.cassandra/cassandra-driver-core

private void assertRow(Row row) {
 assertThat(row.getUUID(0)).isEqualTo(uuid);
 assertThat(row.getObject(0)).isEqualTo(uuid);
 assertThat(row.get(0, UUID.class)).isEqualTo(uuid);
 assertThat(row.getString(1)).isEqualTo("John Doe");
 assertThat(row.getObject(1)).isEqualTo("John Doe");
 assertThat(row.get(1, String.class)).isEqualTo("John Doe");
 assertThat(row.getTupleValue(2)).isEqualTo(locationValue);
 assertThat(row.getObject(2)).isEqualTo(locationValue);
 assertThat(row.get(2, TupleValue.class)).isEqualTo(locationValue);
}

代码示例来源:origin: com.datastax.cassandra/cassandra-driver-core

private void assertRow(Row row) {
 assertThat(row.getUUID(0)).isEqualTo(uuid);
 assertThat(row.getObject(0)).isEqualTo(uuid);
 assertThat(row.get(0, UUID.class)).isEqualTo(uuid);
 assertThat(row.getString(1)).isEqualTo("John Doe");
 assertThat(row.getObject(1)).isEqualTo("John Doe");
 assertThat(row.get(1, String.class)).isEqualTo("John Doe");
 assertThat(row.getUDTValue(2)).isEqualTo(addressValue);
 assertThat(row.getObject(2)).isEqualTo(addressValue);
 assertThat(row.get(2, UDTValue.class)).isEqualTo(addressValue);
}

代码示例来源:origin: com.datastax.cassandra/cassandra-driver-core

private void assertRow(Row row) {
 assertThat(row.getInt(0)).isEqualTo(42);
 assertThat(row.getObject(0)).isEqualTo(42); // uses the default codec
 assertThat(row.get(0, Integer.class)).isEqualTo(42);
 assertThat(row.get(0, String.class)).isEqualTo("42");
 assertThat(row.getList(1, Integer.class)).isEqualTo(newArrayList(42));
 assertThat(row.getList(1, String.class)).isEqualTo(newArrayList("42"));
 assertThat(row.getObject(1)).isEqualTo(newArrayList(42)); // uses the default codec
 assertThat(row.get(1, TypeTokens.listOf(Integer.class))).isEqualTo(newArrayList(42));
 assertThat(row.get(1, TypeTokens.listOf(String.class))).isEqualTo(newArrayList("42"));
}

代码示例来源:origin: com.datastax.cassandra/cassandra-driver-core

private void assertRow(Row row) {
  assertThat(row.getInt(0)).isEqualTo(n_int);
  assertThat(row.getLong(1)).isEqualTo(n_bigint);
  assertThat(row.getFloat(2)).isEqualTo(n_float);
  assertThat(row.getDouble(3)).isEqualTo(n_double);
  assertThat(row.getVarint(4)).isEqualTo(n_varint);
  assertThat(row.getDecimal(5)).isEqualTo(n_decimal);
  // with getObject
  assertThat(row.getObject(0)).isEqualTo(n_int);
  assertThat(row.getObject(1)).isEqualTo(n_bigint);
  assertThat(row.getObject(2)).isEqualTo(n_float);
  assertThat(row.getObject(3)).isEqualTo(n_double);
  assertThat(row.getObject(4)).isEqualTo(n_varint);
  assertThat(row.getObject(5)).isEqualTo(n_decimal);
  // with get + type
  assertThat(row.get(0, Integer.class)).isEqualTo(n_int);
  assertThat(row.get(1, Long.class)).isEqualTo(n_bigint);
  assertThat(row.get(2, Float.class)).isEqualTo(n_float);
  assertThat(row.get(3, Double.class)).isEqualTo(n_double);
  assertThat(row.get(4, BigInteger.class)).isEqualTo(n_varint);
  assertThat(row.get(5, BigDecimal.class)).isEqualTo(n_decimal);
 }
}

代码示例来源:origin: com.datastax.cassandra/cassandra-driver-core

private void assertRow(Row row) {
  assertThat(row.getInt(0)).isEqualTo(n_int);
  assertThat(row.getList(1, Integer.class)).isEqualTo(l_int);
  assertThat(row.getList(2, Long.class)).isEqualTo(l_bigint);
  assertThat(row.getSet(3, Float.class)).isEqualTo(s_float);
  assertThat(row.getSet(4, Double.class)).isEqualTo(s_double);
  assertThat(row.getMap(5, Integer.class, BigInteger.class)).isEqualTo(m_varint);
  assertThat(row.getMap(6, Integer.class, BigDecimal.class)).isEqualTo(m_decimal);
  // with get + type
  assertThat(row.get(1, TypeTokens.listOf(Integer.class))).isEqualTo(l_int);
  assertThat(row.get(2, TypeTokens.listOf(Long.class))).isEqualTo(l_bigint);
  assertThat(row.get(3, TypeTokens.setOf(Float.class))).isEqualTo(s_float);
  assertThat(row.get(4, TypeTokens.setOf(Double.class))).isEqualTo(s_double);
  assertThat(row.get(5, TypeTokens.mapOf(Integer.class, BigInteger.class))).isEqualTo(m_varint);
  assertThat(row.get(6, TypeTokens.mapOf(Integer.class, BigDecimal.class))).isEqualTo(m_decimal);
  // with getObject
  assertThat(row.getObject(1)).isEqualTo(l_int);
  assertThat(row.getObject(2)).isEqualTo(l_bigint);
  assertThat(row.getObject(3)).isEqualTo(s_float);
  assertThat(row.getObject(4)).isEqualTo(s_double);
  assertThat(row.getObject(5)).isEqualTo(m_varint);
  assertThat(row.getObject(6)).isEqualTo(m_decimal);
 }
}

代码示例来源:origin: com.datastax.cassandra/cassandra-driver-core

private void assertRow(Row row) {
 assertThat(row.getList(1, elementsType)).isEqualTo(v);
 assertThat(row.get(1, listType)).isEqualTo(v);
}

代码示例来源:origin: com.datastax.cassandra/cassandra-driver-core

/**
 * Validates that columns using the duration type are properly handled by the driver when used as
 * a parameter and retrieved in a row result for a variety of sample inputs.
 *
 * @jira_ticket JAVA-1347
 * @test_category metadata
 */
@Test(groups = "short", dataProvider = "durations")
public void should_serialize_and_deserialize_durations(String durationStr) {
 // read and write
 UUID id = UUID.randomUUID();
 Duration expected = Duration.from(durationStr);
 session().execute("INSERT INTO test_duration (pk, c1) VALUES (?, ?)", id, expected);
 Row row = session().execute("SELECT c1 from test_duration WHERE pk = ?", id).one();
 Duration actual = row.get("c1", Duration.class);
 assertThat(actual).isEqualTo(expected);
}

代码示例来源:origin: com.datastax.cassandra/cassandra-driver-core

private void assertPartialRow(Row row) {
 assertThat(row.getUUID(0)).isEqualTo(uuid);
 assertThat(row.getObject(0)).isEqualTo(uuid);
 assertThat(row.get(0, UUID.class)).isEqualTo(uuid);
 assertThat(row.getString(1)).isEqualTo("John Doe");
 assertThat(row.getObject(1)).isEqualTo("John Doe");
 assertThat(row.get(1, String.class)).isEqualTo("John Doe");
 assertThat(row.getTupleValue(2)).isEqualTo(partialLocationValueRetrieved);
 assertThat(row.getObject(2)).isEqualTo(partialLocationValueRetrieved);
 assertThat(row.get(2, TupleValue.class)).isEqualTo(partialLocationValueRetrieved);
}

代码示例来源:origin: com.datastax.cassandra/cassandra-driver-core

assertThat(row.get(0, Integer.class)).isEqualTo(n_int);
assertThat(row.get(1, Long.class)).isEqualTo(n_bigint);
assertThat(row.get(2, Float.class)).isEqualTo(n_float);
assertThat(row.get(3, Double.class)).isEqualTo(n_double);
assertThat(row.get(4, BigInteger.class)).isEqualTo(n_varint);
assertThat(row.get(5, BigDecimal.class)).isEqualTo(n_decimal);
assertThat(row.get(0, NUMBERBOX_OF_INTEGER_TOKEN)).isEqualTo(new NumberBox<Integer>(n_int));
assertThat(row.get(1, NUMBERBOX_OF_LONG_TOKEN)).isEqualTo(new NumberBox<Long>(n_bigint));
assertThat(row.get(2, NUMBERBOX_OF_FLOAT_TOKEN)).isEqualTo(new NumberBox<Float>(n_float));
assertThat(row.get(3, NUMBERBOX_OF_DOUBLE_TOKEN)).isEqualTo(new NumberBox<Double>(n_double));
assertThat(row.get(4, NUMBERBOX_OF_BIGINTEGER_TOKEN))
  .isEqualTo(new NumberBox<BigInteger>(n_varint));
assertThat(row.get(5, NUMBERBOX_OF_BIGDECIMAL_TOKEN))
  .isEqualTo(new NumberBox<BigDecimal>(n_decimal));

代码示例来源:origin: com.datastax.cassandra/cassandra-driver-core

assertThat(row.getUUID(0)).isEqualTo(uuid);
assertThat(row.getObject(0)).isEqualTo(uuid);
assertThat(row.get(0, UUID.class)).isEqualTo(uuid);
assertThat(row.getString(1)).isEqualTo("John Doe");
assertThat(row.getObject(1)).isEqualTo("John Doe");
assertThat(row.get(1, String.class)).isEqualTo("John Doe");
assertThat(row.getUDTValue(2)).isEqualTo(addressValue);
assertThat(row.get(2, UDTValue.class)).isEqualTo(addressValue);
assertThat(row.get(2, Address.class)).isEqualTo(address);

代码示例来源:origin: com.datastax.dse/dse-java-driver-core

private void assertRow(Row row) {
 assertThat(row.getInt(0)).isEqualTo(42);
 assertThat(row.getObject(0)).isEqualTo(42); // uses the default codec
 assertThat(row.get(0, Integer.class)).isEqualTo(42);
 assertThat(row.get(0, String.class)).isEqualTo("42");
 assertThat(row.getList(1, Integer.class)).isEqualTo(newArrayList(42));
 assertThat(row.getList(1, String.class)).isEqualTo(newArrayList("42"));
 assertThat(row.getObject(1)).isEqualTo(newArrayList(42)); // uses the default codec
 assertThat(row.get(1, TypeTokens.listOf(Integer.class))).isEqualTo(newArrayList(42));
 assertThat(row.get(1, TypeTokens.listOf(String.class))).isEqualTo(newArrayList("42"));
}

代码示例来源:origin: org.apache.cassandra/cassandra-all

@Override
public <T> T get(int i, TypeCodec<T> typeCodec)
{
  return row.get(i, typeCodec);
}

代码示例来源:origin: com.datastax.cassandra/cassandra-driver-core

assertThat(row.getUUID(0)).isEqualTo(uuid);
assertThat(row.getObject(0)).isEqualTo(uuid);
assertThat(row.get(0, UUID.class)).isEqualTo(uuid);
assertThat(row.getString(1)).isEqualTo("John Doe");
assertThat(row.getObject(1)).isEqualTo("John Doe");
assertThat(row.get(1, String.class)).isEqualTo("John Doe");
assertThat(row.getTupleValue(2)).isEqualTo(locationValue);
assertThat(row.get(2, TupleValue.class)).isEqualTo(locationValue);
assertThat(row.get(2, Location.class)).isEqualTo(location);

代码示例来源:origin: jsevellec/cassandra-unit

@Override
public <T> T get(int i, Class<T> aClass)
{
  return row.get(i, aClass);
}

代码示例来源:origin: com.datastax.cassandra/cassandra-driver-core

assertThat(row.getUUID(0)).isEqualTo(uuid);
assertThat(row.getObject(0)).isEqualTo(uuid);
assertThat(row.get(0, UUID.class)).isEqualTo(uuid);
assertThat(row.getString(1)).isEqualTo("John Doe");
assertThat(row.getObject(1)).isEqualTo("John Doe");
assertThat(row.get(1, String.class)).isEqualTo("John Doe");
assertThat(row.getTupleValue(2)).isEqualTo(locationType.newValue(37.387224f, null));
assertThat(row.get(2, TupleValue.class)).isEqualTo(locationType.newValue(37.387224f, null));
assertThat(row.get(2, Location.class)).isEqualTo(partialLocation);

代码示例来源:origin: com.strapdata.cassandra/cassandra-all

@Override
public <T> T get(int i, Class<T> aClass)
{
  return row.get(i, aClass);
}

代码示例来源:origin: jsevellec/cassandra-unit

@Override
public <T> T get(int i, TypeToken<T> typeToken)
{
  return row.get(i, typeToken);
}

代码示例来源:origin: hugegraph/hugegraph

Row row = it.next();
String ownerVertex = row.get(OWNER_VERTEX, String.class);
session.add(buildDelete(label, ownerVertex, Directions.OUT));
String otherVertex = row.get(OTHER_VERTEX, String.class);
session.add(buildDelete(label, otherVertex, Directions.IN));

代码示例来源:origin: hugegraph/hugegraph

fieldValues = it.next().get(FIELD_VALUES, String.class);
Delete delete = QueryBuilder.delete().from(this.table());
delete.where(formatEQ(HugeKeys.INDEX_LABEL_ID, indexLabel));

代码示例来源:origin: org.apache.james/apache-james-mailbox-cassandra

public Optional<QuotaCount> getMaxMessage(QuotaRoot quotaRoot) {
  ResultSet resultSet = session.execute(getMaxMessageStatement.bind(quotaRoot.getValue()));
  if (resultSet.isExhausted()) {
    return Optional.empty();
  }
  Long maxMessages = resultSet.one().get(CassandraMaxQuota.MESSAGE_COUNT, Long.class);
  return QuotaCodec.longToQuotaCount(maxMessages);
}

相关文章