本文整理了Java中com.datastax.driver.core.TypeCodec.cdouble()
方法的一些代码示例,展示了TypeCodec.cdouble()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。TypeCodec.cdouble()
方法的具体详情如下:
包路径:com.datastax.driver.core.TypeCodec
类名称:TypeCodec
方法名:cdouble
[英]Return the default codec for the CQL type double. The returned codec maps the CQL type double into the Java type Double. The returned instance is a singleton.
[中]返回CQL类型double的默认编解码器。返回的编解码器将CQL类型double映射为Java类型double。返回的实例是一个单例。
代码示例来源: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: org.apache.cassandra/cassandra-all
protected double compose_double(ProtocolVersion protocolVersion, int argIndex, ByteBuffer value)
{
assert value != null && value.remaining() > 0;
return (double) UDHelper.deserialize(TypeCodec.cdouble(), protocolVersion, value);
}
代码示例来源:origin: jsevellec/cassandra-unit
protected double compose_double(ProtocolVersion protocolVersion, int argIndex, ByteBuffer value)
{
assert value != null && value.remaining() > 0;
return (double) UDHelper.deserialize(TypeCodec.cdouble(), protocolVersion, value);
}
代码示例来源:origin: com.strapdata.cassandra/cassandra-all
protected double compose_double(ProtocolVersion protocolVersion, int argIndex, ByteBuffer value)
{
assert value != null && value.remaining() > 0;
return (double) UDHelper.deserialize(TypeCodec.cdouble(), 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
@Override
public Cluster.Builder createClusterBuilder() {
return Cluster.builder()
.withCodecRegistry(
new CodecRegistry()
.register(
new NumberBoxCodec<Integer>(TypeCodec.cint()),
new NumberBoxCodec<Long>(TypeCodec.bigint()),
new NumberBoxCodec<Float>(TypeCodec.cfloat()),
new NumberBoxCodec<Double>(TypeCodec.cdouble()),
new NumberBoxCodec<BigInteger>(TypeCodec.varint()),
new NumberBoxCodec<BigDecimal>(TypeCodec.decimal())));
}
代码示例来源:origin: com.datastax.cassandra/cassandra-driver-core
/** Ensures that primitive types are correctly handled and wrapped when necessary. */
@Test(groups = "unit")
public void should_wrap_primitive_types() {
assertThat(TypeCodec.cboolean()).accepts(Boolean.class).accepts(Boolean.TYPE).accepts(true);
assertThat(TypeCodec.cint()).accepts(Integer.class).accepts(Integer.TYPE).accepts(42);
assertThat(TypeCodec.bigint()).accepts(Long.class).accepts(Long.TYPE).accepts(42L);
assertThat(TypeCodec.cfloat()).accepts(Float.class).accepts(Float.TYPE).accepts(42.0F);
assertThat(TypeCodec.cdouble()).accepts(Double.class).accepts(Double.TYPE).accepts(42.0D);
}
代码示例来源: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: 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: org.apache.gora/gora-cassandra
break;
case "double":
typeCodec = TypeCodec.cdouble();
break;
case "float":
代码示例来源:origin: apache/gora
break;
case "double":
typeCodec = TypeCodec.cdouble();
break;
case "float":
代码示例来源: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: com.datastax.dse/dse-java-driver-core
@Override
public Cluster.Builder createClusterBuilder() {
return Cluster.builder()
.withCodecRegistry(
new CodecRegistry()
.register(
new NumberBoxCodec<Integer>(TypeCodec.cint()),
new NumberBoxCodec<Long>(TypeCodec.bigint()),
new NumberBoxCodec<Float>(TypeCodec.cfloat()),
new NumberBoxCodec<Double>(TypeCodec.cdouble()),
new NumberBoxCodec<BigInteger>(TypeCodec.varint()),
new NumberBoxCodec<BigDecimal>(TypeCodec.decimal())));
}
代码示例来源:origin: org.apache.gora/gora-cassandra
this.cluster.getConfiguration().getCodecRegistry().register(new OptionalCodec<>(TypeCodec.blob()));
this.cluster.getConfiguration().getCodecRegistry().register(new OptionalCodec<>(TypeCodec.cboolean()));
this.cluster.getConfiguration().getCodecRegistry().register(new OptionalCodec<>(TypeCodec.cdouble()));
this.cluster.getConfiguration().getCodecRegistry().register(new OptionalCodec<>(TypeCodec.cfloat()));
this.cluster.getConfiguration().getCodecRegistry().register(new OptionalCodec<>(TypeCodec.cint()));
代码示例来源:origin: com.datastax.dse/dse-java-driver-core
/** Ensures that primitive types are correctly handled and wrapped when necessary. */
@Test(groups = "unit")
public void should_wrap_primitive_types() {
assertThat(TypeCodec.cboolean()).accepts(Boolean.class).accepts(Boolean.TYPE).accepts(true);
assertThat(TypeCodec.cint()).accepts(Integer.class).accepts(Integer.TYPE).accepts(42);
assertThat(TypeCodec.bigint()).accepts(Long.class).accepts(Long.TYPE).accepts(42L);
assertThat(TypeCodec.cfloat()).accepts(Float.class).accepts(Float.TYPE).accepts(42.0F);
assertThat(TypeCodec.cdouble()).accepts(Double.class).accepts(Double.TYPE).accepts(42.0D);
}
代码示例来源:origin: apache/gora
this.cluster.getConfiguration().getCodecRegistry().register(new OptionalCodec<>(TypeCodec.blob()));
this.cluster.getConfiguration().getCodecRegistry().register(new OptionalCodec<>(TypeCodec.cboolean()));
this.cluster.getConfiguration().getCodecRegistry().register(new OptionalCodec<>(TypeCodec.cdouble()));
this.cluster.getConfiguration().getCodecRegistry().register(new OptionalCodec<>(TypeCodec.cfloat()));
this.cluster.getConfiguration().getCodecRegistry().register(new OptionalCodec<>(TypeCodec.cint()));
代码示例来源: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()}
};
}
内容来源于网络,如有侵权,请联系作者删除!