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

x33g5p2x  于2022-01-30 转载在 其他  
字(11.8k)|赞(0)|评价(0)|浏览(117)

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

TypeCodec.smallInt介绍

[英]Return the default codec for the CQL type smallint. The returned codec maps the CQL type smallint into the Java type Short. The returned instance is a singleton.
[中]返回CQL类型smallint的默认编解码器。返回的编解码器将CQL类型smallint映射为Java类型Short。返回的实例是一个单例。

代码示例

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

@DataProvider
public static Object[][] value() {
 return new Object[][] {
  {ByteBuffer.allocate(0), TypeCodec.blob()},
  {Boolean.TRUE, TypeCodec.cboolean()},
  {(short) 42, TypeCodec.smallInt()},
  {(byte) 42, TypeCodec.tinyInt()},
  {42, TypeCodec.cint()},
  {42L, TypeCodec.bigint()},
  {42D, TypeCodec.cdouble()},
  {42F, TypeCodec.cfloat()},
  {new BigInteger("1234"), TypeCodec.varint()},
  {new BigDecimal("123.45"), TypeCodec.decimal()},
  {"foo", TypeCodec.varchar()},
  {new Date(42), TypeCodec.timestamp()},
  {LocalDate.fromDaysSinceEpoch(42), TypeCodec.date()},
  {UUID.randomUUID(), TypeCodec.uuid()},
  {mock(InetAddress.class), TypeCodec.inet()},
  {Duration.from("1mo2d3h"), TypeCodec.duration()}
 };
}

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

protected short compose_short(ProtocolVersion protocolVersion, int argIndex, ByteBuffer value)
{
  assert value != null && value.remaining() > 0;
  return (short) UDHelper.deserialize(TypeCodec.smallInt(), protocolVersion, value);
}

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

protected short compose_short(ProtocolVersion protocolVersion, int argIndex, ByteBuffer value)
{
  assert value != null && value.remaining() > 0;
  return (short) UDHelper.deserialize(TypeCodec.smallInt(), protocolVersion, value);
}

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

protected short compose_short(ProtocolVersion protocolVersion, int argIndex, ByteBuffer value)
{
  assert value != null && value.remaining() > 0;
  return (short) UDHelper.deserialize(TypeCodec.smallInt(), protocolVersion, value);
}

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

@DataProvider
public static Object[][] cqlAndValue() {
 return new Object[][] {
  {DataType.blob(), ByteBuffer.allocate(0), TypeCodec.blob()},
  {DataType.cboolean(), true, TypeCodec.cboolean()},
  {DataType.smallint(), (short) 42, TypeCodec.smallInt()},
  {DataType.tinyint(), (byte) 42, TypeCodec.tinyInt()},
  {DataType.cint(), 42, TypeCodec.cint()},
  {DataType.bigint(), 42L, TypeCodec.bigint()},
  {DataType.counter(), 42L, TypeCodec.counter()},
  {DataType.cdouble(), 42D, TypeCodec.cdouble()},
  {DataType.cfloat(), 42F, TypeCodec.cfloat()},
  {DataType.varint(), new BigInteger("1234"), TypeCodec.varint()},
  {DataType.decimal(), new BigDecimal("123.45"), TypeCodec.decimal()},
  {DataType.varchar(), "foo", TypeCodec.varchar()},
  {DataType.ascii(), "foo", TypeCodec.ascii()},
  {DataType.timestamp(), new Date(42), TypeCodec.timestamp()},
  {DataType.date(), LocalDate.fromDaysSinceEpoch(42), TypeCodec.date()},
  {DataType.time(), 42L, TypeCodec.time()},
  {DataType.uuid(), UUID.randomUUID(), TypeCodec.uuid()},
  {DataType.timeuuid(), UUID.randomUUID(), TypeCodec.timeUUID()},
  {DataType.inet(), mock(InetAddress.class), TypeCodec.inet()},
  {DataType.duration(), Duration.from("1mo2d3h"), TypeCodec.duration()}
 };
}

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

@DataProvider
public static Object[][] cql() {
 return new Object[][] {
  {DataType.blob(), TypeCodec.blob()},
  {DataType.cboolean(), TypeCodec.cboolean()},
  {DataType.smallint(), TypeCodec.smallInt()},
  {DataType.tinyint(), TypeCodec.tinyInt()},
  {DataType.cint(), TypeCodec.cint()},
  {DataType.bigint(), TypeCodec.bigint()},
  {DataType.counter(), TypeCodec.counter()},
  {DataType.cdouble(), TypeCodec.cdouble()},
  {DataType.cfloat(), TypeCodec.cfloat()},
  {DataType.varint(), TypeCodec.varint()},
  {DataType.decimal(), TypeCodec.decimal()},
  {DataType.varchar(), TypeCodec.varchar()},
  {DataType.ascii(), TypeCodec.ascii()},
  {DataType.timestamp(), TypeCodec.timestamp()},
  {DataType.date(), TypeCodec.date()},
  {DataType.time(), TypeCodec.time()},
  {DataType.uuid(), TypeCodec.uuid()},
  {DataType.timeuuid(), TypeCodec.timeUUID()},
  {DataType.inet(), TypeCodec.inet()},
  {DataType.duration(), TypeCodec.duration()}
 };
}

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

@DataProvider
public static Object[][] cqlAndJava() {
 return new Object[][] {
  {DataType.blob(), ByteBuffer.class, TypeCodec.blob()},
  {DataType.cboolean(), Boolean.class, TypeCodec.cboolean()},
  {DataType.smallint(), Short.class, TypeCodec.smallInt()},
  {DataType.tinyint(), Byte.class, TypeCodec.tinyInt()},
  {DataType.cint(), Integer.class, TypeCodec.cint()},
  {DataType.bigint(), Long.class, TypeCodec.bigint()},
  {DataType.counter(), Long.class, TypeCodec.counter()},
  {DataType.cdouble(), Double.class, TypeCodec.cdouble()},
  {DataType.cfloat(), Float.class, TypeCodec.cfloat()},
  {DataType.varint(), BigInteger.class, TypeCodec.varint()},
  {DataType.decimal(), BigDecimal.class, TypeCodec.decimal()},
  {DataType.varchar(), String.class, TypeCodec.varchar()},
  {DataType.ascii(), String.class, TypeCodec.ascii()},
  {DataType.timestamp(), Date.class, TypeCodec.timestamp()},
  {DataType.date(), LocalDate.class, TypeCodec.date()},
  {DataType.time(), Long.class, TypeCodec.time()},
  {DataType.uuid(), UUID.class, TypeCodec.uuid()},
  {DataType.timeuuid(), UUID.class, TypeCodec.timeUUID()},
  {DataType.inet(), InetAddress.class, TypeCodec.inet()},
  {DataType.duration(), Duration.class, TypeCodec.duration()}
 };
}

代码示例来源:origin: locationtech/geowave

CassandraField.GW_ADAPTER_ID_KEY.getBindMarkerName(),
  adapterId,
  TypeCodec.smallInt());
statement.set(
  CassandraField.GW_PARTITION_ID_KEY.getBindMarkerName(),

代码示例来源:origin: locationtech/geowave

public CassandraRow result() {
  if ((partitionKey != null) && (sortKey != null)) {
   final BoundStatement boundRead = new BoundStatement(preparedRead);
   boundRead.set(
     CassandraField.GW_SORT_KEY.getBindMarkerName(),
     ByteBuffer.wrap(sortKey),
     ByteBuffer.class);
   boundRead.set(
     CassandraField.GW_ADAPTER_ID_KEY.getBindMarkerName(),
     internalAdapterId,
     TypeCodec.smallInt());
   boundRead.set(
     CassandraField.GW_PARTITION_ID_KEY.getBindMarkerName(),
     ByteBuffer.wrap(partitionKey),
     ByteBuffer.class);
   try (CloseableIterator<CassandraRow> it = operations.executeQuery(boundRead)) {
    if (it.hasNext()) {
     // there should only be one entry with this index
     return it.next();
    }
   }
  }
  return null;
 }
}

代码示例来源:origin: locationtech/geowave

CassandraField.GW_ADAPTER_ID_KEY.getBindMarkerName(),
  Arrays.asList(ArrayUtils.toObject(adapterIds)),
  TypeCodec.list(TypeCodec.smallInt()));
statements.add(boundRead);

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

@DataProvider
public static Object[][] value() {
 return new Object[][] {
  {ByteBuffer.allocate(0), TypeCodec.blob()},
  {Boolean.TRUE, TypeCodec.cboolean()},
  {(short) 42, TypeCodec.smallInt()},
  {(byte) 42, TypeCodec.tinyInt()},
  {42, TypeCodec.cint()},
  {42L, TypeCodec.bigint()},
  {42D, TypeCodec.cdouble()},
  {42F, TypeCodec.cfloat()},
  {new BigInteger("1234"), TypeCodec.varint()},
  {new BigDecimal("123.45"), TypeCodec.decimal()},
  {"foo", TypeCodec.varchar()},
  {new Date(42), TypeCodec.timestamp()},
  {LocalDate.fromDaysSinceEpoch(42), TypeCodec.date()},
  {UUID.randomUUID(), TypeCodec.uuid()},
  {mock(InetAddress.class), TypeCodec.inet()},
  {Duration.from("1mo2d3h"), TypeCodec.duration()}
 };
}

代码示例来源:origin: apache/gora

break;
case "smallint":
 typeCodec = TypeCodec.smallInt();
 break;
case "time":

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

break;
case "smallint":
 typeCodec = TypeCodec.smallInt();
 break;
case "time":

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

@DataProvider
public static Object[][] cqlAndValue() {
 return new Object[][] {
  {DataType.blob(), ByteBuffer.allocate(0), TypeCodec.blob()},
  {DataType.cboolean(), true, TypeCodec.cboolean()},
  {DataType.smallint(), (short) 42, TypeCodec.smallInt()},
  {DataType.tinyint(), (byte) 42, TypeCodec.tinyInt()},
  {DataType.cint(), 42, TypeCodec.cint()},
  {DataType.bigint(), 42L, TypeCodec.bigint()},
  {DataType.counter(), 42L, TypeCodec.counter()},
  {DataType.cdouble(), 42D, TypeCodec.cdouble()},
  {DataType.cfloat(), 42F, TypeCodec.cfloat()},
  {DataType.varint(), new BigInteger("1234"), TypeCodec.varint()},
  {DataType.decimal(), new BigDecimal("123.45"), TypeCodec.decimal()},
  {DataType.varchar(), "foo", TypeCodec.varchar()},
  {DataType.ascii(), "foo", TypeCodec.ascii()},
  {DataType.timestamp(), new Date(42), TypeCodec.timestamp()},
  {DataType.date(), LocalDate.fromDaysSinceEpoch(42), TypeCodec.date()},
  {DataType.time(), 42L, TypeCodec.time()},
  {DataType.uuid(), UUID.randomUUID(), TypeCodec.uuid()},
  {DataType.timeuuid(), UUID.randomUUID(), TypeCodec.timeUUID()},
  {DataType.inet(), mock(InetAddress.class), TypeCodec.inet()},
  {DataType.duration(), Duration.from("1mo2d3h"), TypeCodec.duration()}
 };
}

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

this.cluster.getConfiguration().getCodecRegistry().register(new OptionalCodec<>(TypeCodec.decimal()));
this.cluster.getConfiguration().getCodecRegistry().register(new OptionalCodec<>(TypeCodec.inet()));
this.cluster.getConfiguration().getCodecRegistry().register(new OptionalCodec<>(TypeCodec.smallInt()));
this.cluster.getConfiguration().getCodecRegistry().register(new OptionalCodec<>(TypeCodec.time()));
this.cluster.getConfiguration().getCodecRegistry().register(new OptionalCodec<>(TypeCodec.timestamp()));

代码示例来源:origin: apache/gora

this.cluster.getConfiguration().getCodecRegistry().register(new OptionalCodec<>(TypeCodec.decimal()));
this.cluster.getConfiguration().getCodecRegistry().register(new OptionalCodec<>(TypeCodec.inet()));
this.cluster.getConfiguration().getCodecRegistry().register(new OptionalCodec<>(TypeCodec.smallInt()));
this.cluster.getConfiguration().getCodecRegistry().register(new OptionalCodec<>(TypeCodec.time()));
this.cluster.getConfiguration().getCodecRegistry().register(new OptionalCodec<>(TypeCodec.timestamp()));

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

@DataProvider
public static Object[][] cql() {
 return new Object[][] {
  {DataType.blob(), TypeCodec.blob()},
  {DataType.cboolean(), TypeCodec.cboolean()},
  {DataType.smallint(), TypeCodec.smallInt()},
  {DataType.tinyint(), TypeCodec.tinyInt()},
  {DataType.cint(), TypeCodec.cint()},
  {DataType.bigint(), TypeCodec.bigint()},
  {DataType.counter(), TypeCodec.counter()},
  {DataType.cdouble(), TypeCodec.cdouble()},
  {DataType.cfloat(), TypeCodec.cfloat()},
  {DataType.varint(), TypeCodec.varint()},
  {DataType.decimal(), TypeCodec.decimal()},
  {DataType.varchar(), TypeCodec.varchar()},
  {DataType.ascii(), TypeCodec.ascii()},
  {DataType.timestamp(), TypeCodec.timestamp()},
  {DataType.date(), TypeCodec.date()},
  {DataType.time(), TypeCodec.time()},
  {DataType.uuid(), TypeCodec.uuid()},
  {DataType.timeuuid(), TypeCodec.timeUUID()},
  {DataType.inet(), TypeCodec.inet()},
  {DataType.duration(), TypeCodec.duration()}
 };
}

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

@DataProvider
public static Object[][] cqlAndJava() {
 return new Object[][] {
  {DataType.blob(), ByteBuffer.class, TypeCodec.blob()},
  {DataType.cboolean(), Boolean.class, TypeCodec.cboolean()},
  {DataType.smallint(), Short.class, TypeCodec.smallInt()},
  {DataType.tinyint(), Byte.class, TypeCodec.tinyInt()},
  {DataType.cint(), Integer.class, TypeCodec.cint()},
  {DataType.bigint(), Long.class, TypeCodec.bigint()},
  {DataType.counter(), Long.class, TypeCodec.counter()},
  {DataType.cdouble(), Double.class, TypeCodec.cdouble()},
  {DataType.cfloat(), Float.class, TypeCodec.cfloat()},
  {DataType.varint(), BigInteger.class, TypeCodec.varint()},
  {DataType.decimal(), BigDecimal.class, TypeCodec.decimal()},
  {DataType.varchar(), String.class, TypeCodec.varchar()},
  {DataType.ascii(), String.class, TypeCodec.ascii()},
  {DataType.timestamp(), Date.class, TypeCodec.timestamp()},
  {DataType.date(), LocalDate.class, TypeCodec.date()},
  {DataType.time(), Long.class, TypeCodec.time()},
  {DataType.uuid(), UUID.class, TypeCodec.uuid()},
  {DataType.timeuuid(), UUID.class, TypeCodec.timeUUID()},
  {DataType.inet(), InetAddress.class, TypeCodec.inet()},
  {DataType.duration(), Duration.class, TypeCodec.duration()}
 };
}

相关文章