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

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

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

TypeCodec.custom介绍

[英]Return a newly-created codec for the given CQL custom type.

The returned codec maps the custom type into the Java type ByteBuffer, thus providing a (very lightweight) support for Cassandra types that do not have a CQL equivalent.

Note that the returned codec assumes that CQL literals for the given custom type are expressed in binary form as well, e.g. 0xcafebabe. If this is not the case, the returned codec might be unable to #parse(String)and #format(Object) literals for this type. This is notoriously true for types inheriting from org.apache.cassandra.db.marshal.AbstractCompositeType, whose CQL literals are actually expressed as quoted strings.

This method does not cache returned instances and returns a newly-allocated object at each invocation.
[中]为给定的CQL自定义类型返回新创建的编解码器。
返回的编解码器将自定义类型映射到Java类型ByteBuffer,从而为没有CQL等价物的Cassandra类型提供(非常轻量级)支持。
请注意,返回的编解码器假定给定自定义类型的CQL文本也以二进制形式表示,例如0xcafebabe。如果情况并非如此,返回的编解码器可能无法#解析(字符串)和#格式化(对象)此类型的文本。对于从org继承的类型来说,这是众所周知的事实。阿帕奇。卡桑德拉。db。元帅AbstractCompositeType,其CQL文本实际上表示为带引号的字符串。
此方法不会缓存返回的实例,而是在每次调用时返回一个新分配的对象。

代码示例

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

return (TypeCodec<T>) TypeCodec.custom((DataType.CustomType) cqlType);

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

return (TypeCodec<T>) TypeCodec.custom((DataType.CustomType) cqlType);

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

return (TypeCodec<T>) TypeCodec.custom((DataType.CustomType) cqlType);

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

return (TypeCodec<T>) TypeCodec.custom((DataType.CustomType) cqlType);

代码示例来源:origin: com.facebook.presto.cassandra/cassandra-driver

return (TypeCodec<T>) TypeCodec.custom((DataType.CustomType) cqlType);

代码示例来源:origin: io.prestosql.cassandra/cassandra-driver

return (TypeCodec<T>) TypeCodec.custom((DataType.CustomType) cqlType);

代码示例来源:origin: com.facebook.presto.cassandra/cassandra-driver

return (TypeCodec<T>) TypeCodec.custom((DataType.CustomType) cqlType);

代码示例来源:origin: io.prestosql.cassandra/cassandra-driver

return (TypeCodec<T>) TypeCodec.custom((DataType.CustomType) cqlType);

相关文章