本文整理汇总了Java中me.prettyprint.cassandra.serializers.LongSerializer类的典型用法代码示例。如果您正苦于以下问题:Java LongSerializer类的具体用法?Java LongSerializer怎么用?Java LongSerializer使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
LongSerializer类属于me.prettyprint.cassandra.serializers包,在下文中一共展示了LongSerializer类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getSerializer
import me.prettyprint.cassandra.serializers.LongSerializer; //导入依赖的package包/类
@SuppressWarnings({ "rawtypes", "unchecked" })
public static <T> Serializer<T> getSerializer(Class<?> valueClass) {
Serializer serializer = null;
if (valueClass.equals(Utf8.class) || valueClass.equals(CharSequence.class)) {
serializer = CharSequenceSerializer.get();
} else if (valueClass.equals(Boolean.class) || valueClass.equals(boolean.class)) {
serializer = BooleanSerializer.get();
} else if (valueClass.equals(ByteBuffer.class)) {
serializer = ByteBufferSerializer.get();
} else if (valueClass.equals(Double.class) || valueClass.equals(double.class)) {
serializer = DoubleSerializer.get();
} else if (valueClass.equals(Float.class) || valueClass.equals(float.class)) {
serializer = FloatSerializer.get();
} else if (valueClass.equals(Integer.class) || valueClass.equals(int.class)) {
serializer = IntegerSerializer.get();
} else if (valueClass.equals(Long.class) || valueClass.equals(long.class)) {
serializer = LongSerializer.get();
} else if (valueClass.equals(String.class)) {
serializer = StringSerializer.get();
} else {
serializer = SerializerTypeInferer.getSerializer(valueClass);
}
return serializer;
}
示例2: getSerializer
import me.prettyprint.cassandra.serializers.LongSerializer; //导入依赖的package包/类
@SuppressWarnings({ "rawtypes", "unchecked" })
public static <T> Serializer<T> getSerializer(Class<?> valueClass) {
Serializer serializer = null;
if (valueClass.equals(Utf8.class)) {
serializer = Utf8Serializer.get();
} else if (valueClass.equals(Boolean.class) || valueClass.equals(boolean.class)) {
serializer = BooleanSerializer.get();
} else if (valueClass.equals(ByteBuffer.class)) {
serializer = ByteBufferSerializer.get();
} else if (valueClass.equals(Double.class) || valueClass.equals(double.class)) {
serializer = DoubleSerializer.get();
} else if (valueClass.equals(Float.class) || valueClass.equals(float.class)) {
serializer = FloatSerializer.get();
} else if (valueClass.equals(Integer.class) || valueClass.equals(int.class)) {
serializer = IntegerSerializer.get();
} else if (valueClass.equals(Long.class) || valueClass.equals(long.class)) {
serializer = LongSerializer.get();
} else if (valueClass.equals(String.class)) {
serializer = StringSerializer.get();
} else {
serializer = SerializerTypeInferer.getSerializer(valueClass);
}
return serializer;
}
示例3: getAsLongValue
import me.prettyprint.cassandra.serializers.LongSerializer; //导入依赖的package包/类
public static Long getAsLongValue( ColumnSlice<String, String> columnSlice, String columnName )
{
LongSerializer ls = LongSerializer.get();
if ( StringUtils.isEmpty( columnName ) )
{
return null;
}
HColumn<String, String> hColumn = columnSlice.getColumnByName( columnName );
return hColumn == null ? null : ls.fromByteBuffer( hColumn.getValueBytes() );
}
示例4: getArtifactsByDateRange
import me.prettyprint.cassandra.serializers.LongSerializer; //导入依赖的package包/类
@Override
public List<ArtifactMetadata> getArtifactsByDateRange( final String repositoryId, final Date startTime,
final Date endTime )
throws MetadataRepositoryException
{
LongSerializer ls = LongSerializer.get();
RangeSlicesQuery<String, String, Long> query = HFactory //
.createRangeSlicesQuery( keyspace, ss, ss, ls ) //
.setColumnFamily( cassandraArchivaManager.getArtifactMetadataFamilyName() ) //
.setColumnNames( ArtifactMetadataModel.COLUMNS ); //
if ( startTime != null )
{
query = query.addGteExpression( WHEN_GATHERED.toString(), startTime.getTime() );
}
if ( endTime != null )
{
query = query.addLteExpression( WHEN_GATHERED.toString(), endTime.getTime() );
}
QueryResult<OrderedRows<String, String, Long>> result = query.execute();
List<ArtifactMetadata> artifactMetadatas = new ArrayList<>( result.get().getCount() );
for ( Row<String, String, Long> row : result.get() )
{
ColumnSlice<String, Long> columnSlice = row.getColumnSlice();
String repositoryName = getAsStringValue( columnSlice, REPOSITORY_NAME.toString() );
if ( StringUtils.equals( repositoryName, repositoryId ) )
{
artifactMetadatas.add( mapArtifactMetadataLongColumnSlice( columnSlice ) );
}
}
return artifactMetadatas;
}
示例5: createColumnName
import me.prettyprint.cassandra.serializers.LongSerializer; //导入依赖的package包/类
private Composite createColumnName(ScheduledMessage scheduledMessage) {
final Composite columnName = new Composite();
columnName.addComponent(scheduledMessage.getFireTime(TimeUnit.MILLISECONDS), LongSerializer.get());
UUID id = scheduledMessage.getId();
final com.eaio.uuid.UUID timeUuid = new com.eaio.uuid.UUID(id.getMostSignificantBits(),id.getLeastSignificantBits());
columnName.addComponent(timeUuid, TimeUUIDSerializer.get());
return columnName;
}
开发者ID:elasticsoftwarefoundation,项目名称:elasticactors,代码行数:9,代码来源:CassandraScheduledMessageRepository.java
示例6: toByteBuffer
import me.prettyprint.cassandra.serializers.LongSerializer; //导入依赖的package包/类
@Override public ByteBuffer toByteBuffer(TestDatedColumn obj) {
if (obj == null) {
return null;
}
Long date = obj.getDate();
return LongSerializer.get().toByteBuffer(date);
}
示例7: fromByteBuffer
import me.prettyprint.cassandra.serializers.LongSerializer; //导入依赖的package包/类
@Override public TestDatedColumn fromByteBuffer(ByteBuffer byteBuffer) {
if (byteBuffer == null) {
return null;
}
Long date = LongSerializer.get().fromByteBuffer(byteBuffer);
return new TestDatedColumn(date);
}
示例8: testIndexedSlices
import me.prettyprint.cassandra.serializers.LongSerializer; //导入依赖的package包/类
private void testIndexedSlices() {
Mutator<String> mutator = HFactory.createMutator(keyspace, stringSerializer);
for (int i = 0; i < 24; i++) {
mutator.addInsertion("fake_key_" + i, COLUMN_FAMILY_INDEXED_1,
HFactory.createStringColumn("fake_column_0", "fake_value_0_" + i))
.addInsertion("fake_key_" + i, COLUMN_FAMILY_INDEXED_1,
HFactory.createStringColumn("column_test_1", "column_test_1_value" + i))
.addInsertion("fake_key_" + i, COLUMN_FAMILY_INDEXED_1,
HFactory.createStringColumn("fake_column_1", "fake_value_1_" + i))
.addInsertion("fake_key_" + i, COLUMN_FAMILY_INDEXED_1,
HFactory.createStringColumn("fake_column_2", "fake_value_2_" + i))
.addInsertion(
"fake_key_" + i,
COLUMN_FAMILY_INDEXED_1,
HFactory.createColumn("birthdate", new Long(1974 + (i % 2)), stringSerializer,
LongSerializer.get()))
.addInsertion(
"fake_key_" + i,
COLUMN_FAMILY_INDEXED_1,
HFactory.createColumn("birthmonth", new Long(i % 12), stringSerializer,
LongSerializer.get()));
}
mutator.execute();
IndexedSlicesQuery<String, String, Long> indexedSlicesQuery = HFactory.createIndexedSlicesQuery(keyspace,
stringSerializer, stringSerializer, LongSerializer.get());
indexedSlicesQuery.setColumnFamily(COLUMN_FAMILY_INDEXED_1);
indexedSlicesQuery.addEqualsExpression("birthdate", 1975L);
indexedSlicesQuery.addGtExpression("birthmonth", 6L);
indexedSlicesQuery.addLtExpression("birthmonth", 8L);
indexedSlicesQuery.setColumnNames("birthdate", "birthmonth");
indexedSlicesQuery.setStartKey("");
QueryResult<OrderedRows<String, String, Long>> result = indexedSlicesQuery.execute();
System.out.println("The results should only have 4 entries: " + result.get().getCount());
}
示例9: getHecubaClientManager
import me.prettyprint.cassandra.serializers.LongSerializer; //导入依赖的package包/类
public HecubaClientManager<Long> getHecubaClientManager(CassandraParamsBean paramsBean) {
return new HectorBasedHecubaClientManager<Long>(paramsBean, LongSerializer.get());
}