本文整理汇总了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;未经允许,请勿转载。 |
请发表评论