|
Log4j 0.9.1 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.log4j.Hierarchy
This class is specialized in retreiving categories by name and also maintaining the category hierarchy.
The casual user should never have to deal with this class. In fact, up until version 0.9.0, this class had default package access.
The structure of the category hierachy is maintained by the
getInstance(java.lang.String)
method. The hierrachy is such that children
link to their parent but parents do not have any pointers to their
children. Moreover, user may choose to instantiate a categories in
any order, in particular decendant before ancestor.
In case child is created before its parent, then it creates a provision node for the parent and adds itself to the provision node. Other children of the same parent only add themselves if there is already a provision node for the parent.
See the code below for further details.
Constructor Summary | |
Hierarchy(Category root)
Create a new Category hierarchy. |
Method Summary | |
void |
clear()
This call will clear all category definitions from the internal hashtable. |
Category |
exists(String name)
Check if the named category exists in the hirarchy. |
static Hierarchy |
getDefaultHierarchy()
Return the default Hierarchy instance. |
Category |
getInstance(String name)
Return a new category instance named as the first parameter using the default factory. |
Category |
getInstance(String name,
CategoryFactory factory)
Return a new category instance named as the first parameter using factory . |
Category |
getRoot()
Get the root of this hierarchy. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public Hierarchy(Category root)
root
- The root of the new hierarchy.Method Detail |
public void clear()
You should really know what you are doing before invoking this method.
public Category exists(String name)
null
.name
- The name of the category to search for.public Category getInstance(String name)
If a category of that name already exists, then it will be returned. Otherwise, a new category will be instantiated and lthen inked with its existing ancestors as well as children.
name
- The name of the category to retreive.public Category getInstance(String name, CategoryFactory factory)
factory
.
If a category of that name already exists, then it will be
returned. Otherwise, a new category will be instantiated by the
factory
parameter and linked with its existing
ancestors as well as children.
name
- The name of the category to retreive.factory
- The factory that will make the new category instance.public static Hierarchy getDefaultHierarchy()
public Category getRoot()
|
Log4j 0.9.1 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |