FileDocCategorySizeDatePackage
StringifierRegistryImpl.javaAPI DocGlassfish v2 API3501Fri May 04 22:31:08 BST 2007com.sun.appserv.management.util.stringifier

StringifierRegistryImpl

public class StringifierRegistryImpl extends Object implements StringifierRegistry
Holds a lookup table for Stringifiers. Certain Stringifier classes may use this registry to aid them in producing suitable output.

Fields Summary
public static final StringifierRegistry
DEFAULT
private final Map
mLookup
private final StringifierRegistry
mNextRegistry
Constructors Summary
public StringifierRegistryImpl()
Create a new registry with no next registry.

	
			       	 
		
	
	
		this( null );
	
public StringifierRegistryImpl(StringifierRegistry registry)
Create a new registry which is chained to an existing registry. When lookup() is called, if it cannot be found in this registry, then the chainee is used.

param
registry the registry to use if this registry fails to find a Stringifier

		mLookup			= new HashMap<Class<?>,Stringifier>();
		mNextRegistry	= registry;
	
Methods Summary
public voidadd(java.lang.Class theClass, Stringifier stringifier)

		if ( lookup( theClass ) != null )
		{
			new Exception().printStackTrace();
		}
		
		mLookup.remove( theClass );
		mLookup.put( theClass, stringifier );
	
public Stringifierlookup(java.lang.Class theClass)

		Stringifier		stringifier	= (Stringifier)mLookup.get( theClass );
		
		if ( stringifier == null && mNextRegistry != null )
		{
			stringifier	= mNextRegistry.lookup( theClass );
		}
		
		return( stringifier );