org.openstreetmap.osmosis.core.store
Class StoreClassRegister

java.lang.Object
  extended by org.openstreetmap.osmosis.core.store.StoreClassRegister

public class StoreClassRegister
extends java.lang.Object

Allocates unique identifiers for class types written to a store and maintains the relationship between classes and their identifiers.

Author:
Brett Henderson

Constructor Summary
StoreClassRegister()
          Creates a new instance.
 
Method Summary
 java.lang.Class<?> getClassFromIdentifier(StoreReader storeReader)
          Returns the class associated with the unique identifier in the store.
 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

StoreClassRegister

public StoreClassRegister()
Creates a new instance.

Method Detail

storeIdentifierForClass

public void storeIdentifierForClass(StoreWriter storeWriter,
                                    java.lang.Class<?> clazz)
Stores the unique identifier for the specified class to the store. If no identifier already exists exists, a new identifier is allocated and the class is registered internally.

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.

Parameters:
storeReader - The store to read class identification information from.
Returns:
The class associated with the identifier.