• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java SerializerTypeInferer类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中me.prettyprint.cassandra.serializers.SerializerTypeInferer的典型用法代码示例。如果您正苦于以下问题:Java SerializerTypeInferer类的具体用法?Java SerializerTypeInferer怎么用?Java SerializerTypeInferer使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



SerializerTypeInferer类属于me.prettyprint.cassandra.serializers包,在下文中一共展示了SerializerTypeInferer类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: getSerializer

import me.prettyprint.cassandra.serializers.SerializerTypeInferer; //导入依赖的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;
}
 
开发者ID:jianglibo,项目名称:gora-boot,代码行数:25,代码来源:GoraSerializerTypeInferer.java


示例2: Cassandra12xMapDAO

import me.prettyprint.cassandra.serializers.SerializerTypeInferer; //导入依赖的package包/类
/**
 * Builds a new data access object with the given data.
 * 
 * @param factory the data access layer factory.
 * @param keyClass the key class.
 * @param valueClass the value class.
 * @param isBidirectional a flag indicating if the map shoulbe be accessed both by value and by key.
 * @param columnFamilyName the column family name.
 */
Cassandra12xMapDAO(
		final DataAccessLayerFactory factory, 
		final Class<K> keyClass, 
		final Class<V> valueClass, 
		final boolean isBidirectional, 
		final String columnFamilyName) {
	_factory = (CumulusDataAccessLayerFactory) factory;
	_keyspace = _factory.getKeyspace();
	
	_serializer_k = SerializerTypeInferer.getSerializer(keyClass);
	_serializer_v = SerializerTypeInferer.getSerializer(valueClass);
	
	_isBidirectional = isBidirectional;
	_cf_name = columnFamilyName;
}
 
开发者ID:cumulusrdf,项目名称:cumulusrdf,代码行数:25,代码来源:Cassandra12xMapDAO.java


示例3: getSerializer

import me.prettyprint.cassandra.serializers.SerializerTypeInferer; //导入依赖的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;
}
 
开发者ID:maestros,项目名称:gora-oraclenosql,代码行数:25,代码来源:GoraSerializerTypeInferer.java


示例4: column

import me.prettyprint.cassandra.serializers.SerializerTypeInferer; //导入依赖的package包/类
public static <A, B> HColumn<A, B> column( final A name, final B value )
{

    return HFactory.createColumn( name, //
                                  value, //
                                  (Serializer<A>) SerializerTypeInferer.getSerializer( name ), //
                                  (Serializer<B>) SerializerTypeInferer.getSerializer( value ) );
}
 
开发者ID:ruikom,项目名称:apache-archiva,代码行数:9,代码来源:CassandraUtils.java


示例5: getSerializerForObject

import me.prettyprint.cassandra.serializers.SerializerTypeInferer; //导入依赖的package包/类
@Override public <T> Serializer<T> getSerializerForObject(Object obj) {
    if (obj != null && obj.getClass().isEnum()) {
        return new EnumSerializer(obj.getClass());
    }
    return SerializerTypeInferer.getSerializer(obj);
}
 
开发者ID:appmetr,项目名称:hercules,代码行数:7,代码来源:ThriftDataDriver.java


示例6: getSerializerForClass

import me.prettyprint.cassandra.serializers.SerializerTypeInferer; //导入依赖的package包/类
@Override public <T> Serializer<T> getSerializerForClass(Class clazz) {
    if (clazz.isEnum()) {
        return new EnumSerializer(clazz);
    }
    return SerializerTypeInferer.getSerializer(clazz);
}
 
开发者ID:appmetr,项目名称:hercules,代码行数:7,代码来源:ThriftDataDriver.java


示例7: guessSerializer

import me.prettyprint.cassandra.serializers.SerializerTypeInferer; //导入依赖的package包/类
/**
 * Returns the {@link Serializer} associated with a given class.
 * 
 * @param clazz the class.
 * @param <T> the class kind.
 * @return the {@link Serializer} associated with a given class.
 */
public static <T> Serializer<T> guessSerializer(final Class<T> clazz) {
	return SerializerTypeInferer.getSerializer(clazz);
}
 
开发者ID:cumulusrdf,项目名称:cumulusrdf,代码行数:11,代码来源:Utils.java



注:本文中的me.prettyprint.cassandra.serializers.SerializerTypeInferer类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java ReferenceSequenceFile类代码示例发布时间:2022-05-23
下一篇:
Java Query类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap