org.apache.log4j.chainsaw.favourites
Class FavouritesRegistry

java.lang.Object
  extended by org.apache.log4j.chainsaw.favourites.FavouritesRegistry

public class FavouritesRegistry
extends java.lang.Object

A singleton class that is used as a Registry of instances of JavaBeans that are in a state that a user prefers.

Author:
Paul Smith

Method Summary
 void addFavourite(Favourite favourite)
          Adds a favourite to this Registry
 void addFavourite(java.lang.String name, java.lang.Object prototype)
          Creates a new Favourite instance after running throught some suitability checks to make sure the object class is ok to be used as a prototype.
 java.util.List getFavourites()
          Returns an unmodifiable List of all the known Favourite instances
 java.util.Collection getFavouritesByClass(java.lang.Class clazz)
          Returns a Collection of Favourite instances whose getPrototype() method returns an object whose class is assignable from clazz, or more formally, such that clazz.isAssignableFrom(favourite.getPrototype().getClass())
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getFavouritesByClass

public java.util.Collection getFavouritesByClass(java.lang.Class clazz)
Returns a Collection of Favourite instances whose getPrototype() method returns an object whose class is assignable from clazz, or more formally, such that clazz.isAssignableFrom(favourite.getPrototype().getClass())

Parameters:
clazz -
Returns:
favourites

addFavourite

public void addFavourite(Favourite favourite)
Adds a favourite to this Registry

Parameters:
favourite -

getFavourites

public java.util.List getFavourites()
Returns an unmodifiable List of all the known Favourite instances

Returns:
favourites

addFavourite

public void addFavourite(java.lang.String name,
                         java.lang.Object prototype)
Creates a new Favourite instance after running throught some suitability checks to make sure the object class is ok to be used as a prototype.

Parameters:
name - The name to use for the favourite
prototype - The object to register
Throws:
java.lang.IllegalArgumentException - if the prototype does not conform to the necessary rules to be used as a prototype (see the package documentation).


Copyright © 2007 Apache Software Foundation. All Rights Reserved.