|
TopoWeb Commons API | ||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.topoweb.xml.Factory
Intended an efficient, thread-safe factory for XML-related objects.
Nested Class Summary | |
protected static class |
Factory.Components
Encapsulates the XML component factories shipped with the runtime. |
Field Summary | |
protected java.lang.ThreadLocal |
threadLocal
The instance's thread-local. |
Constructor Summary | |
Factory()
Creates a new instance. |
Method Summary | |
javax.xml.parsers.DocumentBuilder |
getDocumentBuilder()
Always returns the same DocumentBuilder instance
in any given thread. |
javax.xml.parsers.DocumentBuilderFactory |
getDocumentBuilderFactory()
Always returns the same DocumentBuilderFactory instance
in any given thread. |
static Factory |
getGlobalInstance()
Returns the global instance. |
javax.xml.transform.TransformerFactory |
getTransformerFactory()
Always returns the same TransformerFactory instance
in any given thread. |
protected Factory.Components |
newComponents()
Returns a container for the thread-specific components that will be accessed. |
static void |
setGlobalInstance(Factory global)
Sets the global instance. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected final java.lang.ThreadLocal threadLocal
threadLocal.set(Object)
has no effect on this instance.
Invoking threadLocal.get()
, always returns a
Factory.Components
instance.
newComponents()
Constructor Detail |
public Factory()
newComponents
method.
Method Detail |
public static void setGlobalInstance(Factory global)
global
instance. The value null
is taken to mean an instance of this class.
getGlobalInstance
method.
global
- the new global instancegetGlobalInstance()
public static Factory getGlobalInstance()
setGlobalInstance(Factory)
protected Factory.Components newComponents()
threadLocal.initialValue()
is the return value of this method.
Thus overriding this method, effectively overrides the
initialValue()
method of the internal ThreadLocal
instance.
public javax.xml.transform.TransformerFactory getTransformerFactory()
TransformerFactory
instance
in any given thread.
TransformerFactory
public javax.xml.parsers.DocumentBuilderFactory getDocumentBuilderFactory() throws javax.xml.parsers.ParserConfigurationException
DocumentBuilderFactory
instance
in any given thread.
DocumentBuilderFactory
javax.xml.parsers.ParserConfigurationException
public javax.xml.parsers.DocumentBuilder getDocumentBuilder() throws javax.xml.parsers.ParserConfigurationException
DocumentBuilder
instance
in any given thread.
DocumentBuilder
javax.xml.parsers.ParserConfigurationException
|
TopoWeb Commons API | ||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |