org.springsource.loaded
Class NameRegistry

java.lang.Object
  extended by org.springsource.loaded.NameRegistry

public class NameRegistry
extends java.lang.Object

Manages a mapping of names to numbers. The same number anywhere means the same name. This means that if some type a/b/C has been loaded in two places (by different classloaders), it will have the same number in both. Only one of those a/b/C types will be visible at the location in question, the tricky part could be working out which one (if classloaders are being naughty) but in theory the first time we get confused (due to finding the name twice), we can work out which one is right and use that mapping from then on.

Since:
0.8.1

Method Summary
static int getIdFor(java.lang.String slashedClassName)
          Return the id for a particular type.
static int getIdOrAllocateFor(java.lang.String slashedClassName)
          Return the id for a particular type.
static java.lang.String getTypenameById(int typeId)
           
static void reset()
          Typically used by tests to ensure it looks like a fresh NameRegistry is being used.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

reset

public static void reset()
Typically used by tests to ensure it looks like a fresh NameRegistry is being used.


getIdFor

public static int getIdFor(java.lang.String slashedClassName)
Return the id for a particular type. This method will not allocate a new id if the type is unknown, it will return -1 instead.

Parameters:
slashedClassName - a type name like java/lang/String
Returns:
the allocated ID for that type or -1 if unknown

getIdOrAllocateFor

public static int getIdOrAllocateFor(java.lang.String slashedClassName)
Return the id for a particular type. This method will not allocate a new id if the type is unknown, it will return -1 instead.

Parameters:
slashedClassName - a type name like java/lang/String
Returns:
the allocated ID for that type or -1 if unknown

getTypenameById

public static java.lang.String getTypenameById(int typeId)