org.quilt.reg
Class Registry

java.lang.Object
  |
  +--org.quilt.reg.Registry
Direct Known Subclasses:
QuiltRegistry

public class Registry
extends java.lang.Object

A registry for storing Quilt run-time options. The registry stores key-value pairs, where the key takes the form of an array of Strings. The registry is sorted, but XXX there is currently no support for sequential access or partial-key access.

This class is not thread-safe.

Author:
Jim Dixon

Constructor Summary
Registry()
          No-arg constructor.
 
Method Summary
 void clear()
          Remove all elements from the registry.
 boolean containsKey(java.lang.String[] key)
           
 java.lang.Object get(java.lang.String[] key)
          Get an object from the registry.
 boolean isEmpty()
           
 java.util.Set keySet()
          XXX An overly powerful method.
 java.lang.Object put(java.lang.String[] key, java.lang.Object value)
          Add an object to the registry, overwriting any existing value.
 java.lang.Object remove(java.lang.String[] key)
          Remove an item from the registry.
 int size()
           
 java.lang.String[] splitClassName(java.lang.String name)
          Convert a class or method name into a String array.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Registry

public Registry()
No-arg constructor.

Method Detail

clear

public final void clear()
Remove all elements from the registry.


containsKey

public final boolean containsKey(java.lang.String[] key)
Returns:
True if there is an item under this key in the registry.

get

public final java.lang.Object get(java.lang.String[] key)
Get an object from the registry.

Parameters:
key - Array of strings, the unique key.
Returns:
value Object stored under the key, or null if none.

isEmpty

public final boolean isEmpty()
Returns:
True if there are no elements in the registry.

keySet

public java.util.Set keySet()
XXX An overly powerful method.

Returns:
The (editable) set of keys.

put

public final java.lang.Object put(java.lang.String[] key,
                                  java.lang.Object value)
Add an object to the registry, overwriting any existing value.

Parameters:
key - Array of Strings, the unique key. Must not be null.
value - Object to be stored under this key.
Returns:
Old value if there was one, null otherwise.

remove

public final java.lang.Object remove(java.lang.String[] key)
Remove an item from the registry.

Parameters:
key - Array of Strings.
Returns:
The value associated with the key, or null if none.

size

public final int size()
Returns:
Number of items in the registry.

splitClassName

public final java.lang.String[] splitClassName(java.lang.String name)
Convert a class or method name into a String array.

Returns:
A string array containing the fields of the name.


Copyright © 2001-2003 Apache Software Foundation. All Rights Reserved.