public class

NativeTypeIdProvider

extends AbstractTypeIdProvider
java.lang.Object
   ↳ com.pnfsoftware.jeb.util.serialization.AbstractTypeIdProvider
     ↳ com.pnfsoftware.jeb.util.serialization.NativeTypeIdProvider

Class Overview

A standard provider for native Java types. Currently, this provider supports:

  • Pseudo-support for Object since all objects inherit it
  • Primitive types: boolean, byte, char, short, int, long, float, double
  • Objects wrapping the primitive types: Boolean, Byte, Character, Short, Integer, Long, Float, Double
  • Char-sequence types: String
  • Big-num types: BigInteger and BigDecimal
  • List types: ArrayList, LinkedList, ArrayDeque
  • Set types: HashSet, TreeSet, LinkedHashSet
  • Map types: HashMap, TreeMap, LinkedHashMap, IdentityHashMap
Currently, serializing any other non-native type (or non @Ser type) will result in undefined behavior.

Caveats regarding collections and maps: when serializing those objects, optional parameters such as the initial capacity, the load factor, or even a custom comparator (for tree-sets/maps) are not persisted. Therefore, they cannot be automatically restored. It is up to the implementation to wrap such objects in higher-level classes using a custom constructor that can call the original object (collection or map) constructor's with proper parameters. This is especially critical for TreeMap or TreeSet using custom comparators.

Summary

Public Methods
static ITypeIdProvider getInstance()
Protected Methods
void loadTypes(Map<Class<?>, Integer> map, Map<Integer, Integer> movedmap)
[Expand]
Inherited Methods
From class com.pnfsoftware.jeb.util.serialization.AbstractTypeIdProvider
From class java.lang.Object
From interface com.pnfsoftware.jeb.util.serialization.ITypeIdProvider

Public Methods

public static ITypeIdProvider getInstance ()

Protected Methods

protected void loadTypes (Map<Class<?>, Integer> map, Map<Integer, Integer> movedmap)