本文整理汇总了Java中com.esotericsoftware.kryo.serializers.FieldSerializer.CachedField类的典型用法代码示例。如果您正苦于以下问题:Java CachedField类的具体用法?Java CachedField怎么用?Java CachedField使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
CachedField类属于com.esotericsoftware.kryo.serializers.FieldSerializer包,在下文中一共展示了CachedField类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createCachedField
import com.esotericsoftware.kryo.serializers.FieldSerializer.CachedField; //导入依赖的package包/类
public CachedField createCachedField (Class fieldClass, Field field, FieldSerializer ser) {
CachedField cachedField;
if (fieldClass.isPrimitive()) {
if (fieldClass == boolean.class)
cachedField = new ObjectBooleanField(ser);
else if (fieldClass == byte.class)
cachedField = new ObjectByteField(ser);
else if (fieldClass == char.class)
cachedField = new ObjectCharField(ser);
else if (fieldClass == short.class)
cachedField = new ObjectShortField(ser);
else if (fieldClass == int.class)
cachedField = new ObjectIntField(ser);
else if (fieldClass == long.class)
cachedField = new ObjectLongField(ser);
else if (fieldClass == float.class)
cachedField = new ObjectFloatField(ser);
else if (fieldClass == double.class)
cachedField = new ObjectDoubleField(ser);
else {
cachedField = new ObjectField(ser);
}
} else
cachedField = new ObjectField(ser);
return cachedField;
}
示例2: createCachedField
import com.esotericsoftware.kryo.serializers.FieldSerializer.CachedField; //导入依赖的package包/类
public CachedField createCachedField (Class fieldClass, Field field, FieldSerializer ser) {
CachedField cachedField;
// Use ASM-based serializers
if (fieldClass.isPrimitive()) {
if (fieldClass == boolean.class)
cachedField = new AsmBooleanField();
else if (fieldClass == byte.class)
cachedField = new AsmByteField();
else if (fieldClass == char.class)
cachedField = new AsmCharField();
else if (fieldClass == short.class)
cachedField = new AsmShortField();
else if (fieldClass == int.class)
cachedField = new AsmIntField();
else if (fieldClass == long.class)
cachedField = new AsmLongField();
else if (fieldClass == float.class)
cachedField = new AsmFloatField();
else if (fieldClass == double.class)
cachedField = new AsmDoubleField();
else {
cachedField = new AsmObjectField(ser);
}
} else if (fieldClass == String.class
&& (!ser.kryo.getReferences() || !ser.kryo.getReferenceResolver().useReferences(String.class))) {
cachedField = new AsmStringField();
} else {
cachedField = new AsmObjectField(ser);
}
return cachedField;
}
示例3: createCachedField
import com.esotericsoftware.kryo.serializers.FieldSerializer.CachedField; //导入依赖的package包/类
public CachedField createCachedField (Class fieldClass, Field field, FieldSerializer ser) {
CachedField cachedField;
// Use Unsafe-based serializers
if (fieldClass.isPrimitive()) {
if (fieldClass == boolean.class)
cachedField = new UnsafeBooleanField(field);
else if (fieldClass == byte.class)
cachedField = new UnsafeByteField(field);
else if (fieldClass == char.class)
cachedField = new UnsafeCharField(field);
else if (fieldClass == short.class)
cachedField = new UnsafeShortField(field);
else if (fieldClass == int.class)
cachedField = new UnsafeIntField(field);
else if (fieldClass == long.class)
cachedField = new UnsafeLongField(field);
else if (fieldClass == float.class)
cachedField = new UnsafeFloatField(field);
else if (fieldClass == double.class)
cachedField = new UnsafeDoubleField(field);
else {
cachedField = new UnsafeObjectField(ser);
}
} else if (fieldClass == String.class
&& (!ser.kryo.getReferences() || !ser.kryo.getReferenceResolver().useReferences(String.class))) {
cachedField = new UnsafeStringField(field);
} else {
cachedField = new UnsafeObjectField(ser);
}
return cachedField;
}
示例4: createUnsafeCacheFieldsAndRegions
import com.esotericsoftware.kryo.serializers.FieldSerializer.CachedField; //导入依赖的package包/类
/** Use Unsafe-based information about fields layout in memory to build a list of cached fields and memory regions representing
* consecutive fields in memory */
public abstract void createUnsafeCacheFieldsAndRegions (List<Field> validFields, List<CachedField> cachedFields,
int baseIndex, IntArray useAsm);