public abstract class

AbstractTypeIdProvider

extends Object
implements ITypeIdProvider
java.lang.Object
   ↳ com.pnfsoftware.jeb.util.serialization.AbstractTypeIdProvider
Known Direct Subclasses

Class Overview

Base class for a type-id provider. Type-id providers can be used to de-couple the a saved object from its type name. The type-id can be saved instead, allowing type names to change without breaking the deserialization process.

Summary

Protected Constructors
AbstractTypeIdProvider()
Public Methods
void addAll(ITypeIdProvider provider)
Add of types from a provider to this provider.
int getId(Class<?> c)
Get the ype-id of a given type.
Map<Class<?>, Integer> getMap()
Get the map of type to type-id.
Map<Integer, Class<?>> getReverseMap()
Get the reverse type-id map, mapping a type-id to a type.
Class<?> getType(int typeId)
Get a type by type-id.
Protected Methods
abstract void loadTypes(Map<Class<?>, Integer> map)
[Expand]
Inherited Methods
From class java.lang.Object
From interface com.pnfsoftware.jeb.util.serialization.ITypeIdProvider

Protected Constructors

protected AbstractTypeIdProvider ()

Public Methods

public void addAll (ITypeIdProvider provider)

Add of types from a provider to this provider.

Parameters
provider another provider

public int getId (Class<?> c)

Get the ype-id of a given type.

Parameters
c the non-null type
Returns
  • 0 if the provider cannot find a corresponding type-id for the provided type

public Map<Class<?>, Integer> getMap ()

Get the map of type to type-id.

Returns
  • the type-id map

public Map<Integer, Class<?>> getReverseMap ()

Get the reverse type-id map, mapping a type-id to a type.

Returns
  • the reverse type-id map

public Class<?> getType (int typeId)

Get a type by type-id.

Parameters
typeId the non-zero type-id
Returns
  • the type, null if not found

Protected Methods

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