org.openstreetmap.osmosis.core.store
Class BaseStoreClassRegister

java.lang.Object
  extended by org.openstreetmap.osmosis.core.store.BaseStoreClassRegister
All Implemented Interfaces:
StoreClassRegister
Direct Known Subclasses:
DynamicStoreClassRegister, StaticStoreClassRegister

public class BaseStoreClassRegister
extends java.lang.Object
implements StoreClassRegister

Provides common functionality to store class register implementations.


Constructor Summary
BaseStoreClassRegister()
          Creates a new instance.
 
Method Summary
 java.lang.Class<?> getClassFromIdentifier(StoreReader storeReader)
          Returns the class associated with the unique identifier in the store.
protected  boolean isClassRecognized(java.lang.Class<?> clazz)
          Indicates if the class is recognized by the current register.
protected  void registerClass(java.lang.Class<?> clazz, byte id)
          Registers the class with the specified id.
 void storeIdentifierForClass(StoreWriter storeWriter, java.lang.Class<?> clazz)
          Stores the unique identifier for the specified class to the store.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BaseStoreClassRegister

public BaseStoreClassRegister()
Creates a new instance.

Method Detail

isClassRecognized

protected boolean isClassRecognized(java.lang.Class<?> clazz)
Indicates if the class is recognized by the current register.

Parameters:
clazz - The class to be checked.
Returns:
True if the class is recognized, false otherwise.

registerClass

protected void registerClass(java.lang.Class<?> clazz,
                             byte id)
Registers the class with the specified id.

Parameters:
clazz - The class to be registered.
id - The unique identifier for the class.

storeIdentifierForClass

public void storeIdentifierForClass(StoreWriter storeWriter,
                                    java.lang.Class<?> clazz)
Stores the unique identifier for the specified class to the store.

Specified by:
storeIdentifierForClass in interface StoreClassRegister
Parameters:
storeWriter - The store to write class identification data to.
clazz - The class for which an identifier is required.

getClassFromIdentifier

public java.lang.Class<?> getClassFromIdentifier(StoreReader storeReader)
Returns the class associated with the unique identifier in the store. An exception will be thrown if the identifier is not recognised.

Specified by:
getClassFromIdentifier in interface StoreClassRegister
Parameters:
storeReader - The store to read class identification information from.
Returns:
The class associated with the identifier.