本文整理了Java中com.esotericsoftware.kryo.Kryo.newDefaultSerializer()
方法的一些代码示例,展示了Kryo.newDefaultSerializer()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Kryo.newDefaultSerializer()
方法的具体详情如下:
包路径:com.esotericsoftware.kryo.Kryo
类名称:Kryo
方法名:newDefaultSerializer
[英]Called by #getDefaultSerializer(Class) when no default serializers matched the type. Subclasses can override this method to customize behavior. The default implementation calls SerializerFactory#makeSerializer(Kryo,Class)using the #setDefaultSerializer(Class).
[中]当没有与类型匹配的默认序列化程序时,由#getDefaultSerializer(类)调用。子类可以重写此方法以自定义行为。默认实现使用#setDefaultSerializer(类)调用SerializerFactory#makeSerializer(Kryo,类)。
代码示例来源:origin: alibaba/mdrill
@Override
protected Serializer newDefaultSerializer(Class type) {
if(_override) {
return new SerializableSerializer();
} else {
return super.newDefaultSerializer(type);
}
}
}
代码示例来源:origin: co.paralleluniverse/galaxy
@Override
protected Serializer newDefaultSerializer(Class type) {
final Serializer s = super.newDefaultSerializer(type);
if (s instanceof FieldSerializer)
((FieldSerializer) s).setIgnoreSyntheticFields(false);
return s;
}
代码示例来源:origin: co.paralleluniverse/quasar-core
@Override
protected Serializer newDefaultSerializer(Class type) {
final Serializer s = super.newDefaultSerializer(type);
if (s instanceof FieldSerializer)
((FieldSerializer) s).setIgnoreSyntheticFields(false);
return s;
}
代码示例来源:origin: com.esotericsoftware/kryo
/** Returns the best matching serializer for a class. This method can be overridden to implement custom logic to choose a
* serializer. */
public Serializer getDefaultSerializer (Class type) {
if (type == null) throw new IllegalArgumentException("type cannot be null.");
final Serializer serializerForAnnotation = getDefaultSerializerForAnnotatedType(type);
if (serializerForAnnotation != null) return serializerForAnnotation;
for (int i = 0, n = defaultSerializers.size(); i < n; i++) {
DefaultSerializerEntry entry = defaultSerializers.get(i);
if (entry.type.isAssignableFrom(type)) {
Serializer defaultSerializer = entry.serializerFactory.makeSerializer(this, type);
return defaultSerializer;
}
}
return newDefaultSerializer(type);
}
代码示例来源:origin: com.esotericsoftware/kryo-shaded
/** Returns the best matching serializer for a class. This method can be overridden to implement custom logic to choose a
* serializer. */
public Serializer getDefaultSerializer (Class type) {
if (type == null) throw new IllegalArgumentException("type cannot be null.");
final Serializer serializerForAnnotation = getDefaultSerializerForAnnotatedType(type);
if (serializerForAnnotation != null) return serializerForAnnotation;
for (int i = 0, n = defaultSerializers.size(); i < n; i++) {
DefaultSerializerEntry entry = defaultSerializers.get(i);
if (entry.type.isAssignableFrom(type)) {
Serializer defaultSerializer = entry.serializerFactory.makeSerializer(this, type);
return defaultSerializer;
}
}
return newDefaultSerializer(type);
}
代码示例来源:origin: svn2github/kryo
/** Returns the best matching serializer for a class. This method can be overridden to implement custom logic to choose a
* serializer. */
public Serializer getDefaultSerializer (Class type) {
if (type == null) throw new IllegalArgumentException("type cannot be null.");
if (type.isAnnotationPresent(DefaultSerializer.class)) {
DefaultSerializer defaultSerializerAnnotation = (DefaultSerializer)type.getAnnotation(DefaultSerializer.class);
return ReflectionSerializerFactory.makeSerializer(this, defaultSerializerAnnotation.value(), type);
}
for (int i = 0, n = defaultSerializers.size(); i < n; i++) {
DefaultSerializerEntry entry = defaultSerializers.get(i);
if (entry.type.isAssignableFrom(type)) {
return entry.serializerFactory.makeSerializer(this, type);
}
}
return newDefaultSerializer(type);
}
代码示例来源:origin: com.esotericsoftware.kryo/kryo
/** Returns the best matching serializer for a class. This method can be overridden to implement custom logic to choose a
* serializer. */
public Serializer getDefaultSerializer (Class type) {
if (type == null) throw new IllegalArgumentException("type cannot be null.");
if (type.isAnnotationPresent(DefaultSerializer.class)) {
DefaultSerializer defaultSerializerAnnotation = (DefaultSerializer)type.getAnnotation(DefaultSerializer.class);
return ReflectionSerializerFactory.makeSerializer(this, defaultSerializerAnnotation.value(), type);
}
for (int i = 0, n = defaultSerializers.size(); i < n; i++) {
DefaultSerializerEntry entry = defaultSerializers.get(i);
if (entry.type.isAssignableFrom(type)) {
Serializer defaultSerializer = entry.serializerFactory.makeSerializer(this, type);
return defaultSerializer;
}
}
return newDefaultSerializer(type);
}
内容来源于网络,如有侵权,请联系作者删除!