com.esotericsoftware.kryo.Kryo.getDefaultSerializerForAnnotatedType()方法的使用及代码示例

x33g5p2x  于2022-01-23 转载在 其他  
字(1.8k)|赞(0)|评价(0)|浏览(132)

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

Kryo.getDefaultSerializerForAnnotatedType介绍

暂无

代码示例

代码示例来源: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);
}

相关文章