Package org.jvnet.hk2.config
Class DomDocument<T extends Dom>
- java.lang.Object
-
- org.jvnet.hk2.config.DomDocument<T>
-
- Direct Known Subclasses:
GlassFishDocument
public class DomDocument<T extends Dom> extends Object
Represents a whole DOM tree.- Author:
- Kohsuke Kawaguchi
-
-
Field Summary
Fields Modifier and Type Field Description protected Map<org.glassfish.hk2.api.ActiveDescriptor<? extends ConfigInjector>,ConfigModel>models
-
Constructor Summary
Constructors Constructor Description DomDocument(org.glassfish.hk2.api.ServiceLocator habitat)
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description ConfigModelbuildModel(Class<?> clazz)Obtains aConfigModelfor the given class (Which should haveConfiguredannotation on it.)ConfigModelbuildModel(String fullyQualifiedClassName)Obtains aConfigModelfor the given class (Which should haveConfiguredannotation on it.)List<ConfigModel>getAllModelsImplementing(Class intf)Calculates all @Configured interfaces subclassing the passed interface type.ConfigModelgetModel(Class c)Deprecated.ConfigModelgetModelByElementName(String elementName)Obtains theConfigModelfrom the "global" element name.DomgetRoot()TranslatorgetTranslator()Dommake(org.glassfish.hk2.api.ServiceLocator habitat, XMLStreamReader in, T parent, ConfigModel model)voidsetTranslator(Translator translator)voidwriteTo(XMLStreamWriter w)Writes back the whole DOM tree as an XML document.
-
-
-
Field Detail
-
models
protected final Map<org.glassfish.hk2.api.ActiveDescriptor<? extends ConfigInjector>,ConfigModel> models
-
-
Method Detail
-
getRoot
public Dom getRoot()
-
getTranslator
public Translator getTranslator()
-
setTranslator
public void setTranslator(Translator translator)
-
buildModel
public ConfigModel buildModel(Class<?> clazz)
Obtains aConfigModelfor the given class (Which should haveConfiguredannotation on it.)
-
buildModel
public ConfigModel buildModel(String fullyQualifiedClassName)
Obtains aConfigModelfor the given class (Which should haveConfiguredannotation on it.)
-
getModelByElementName
public ConfigModel getModelByElementName(String elementName)
Obtains theConfigModelfrom the "global" element name.This method uses
buildModel(org.glassfish.hk2.api.ActiveDescriptor<? extends org.jvnet.hk2.config.ConfigInjector>)to lazily build models if necessary.- Returns:
- Null if no configurable component is registered under the given global element name.
-
getAllModelsImplementing
public List<ConfigModel> getAllModelsImplementing(Class intf) throws ClassNotFoundException
Calculates all @Configured interfaces subclassing the passed interface type.- Parameters:
intf- a @Configured interface- Returns:
- List of all @Configured subclasses
- Throws:
ClassNotFoundException
-
getModel
@Deprecated public ConfigModel getModel(Class c)
Deprecated.
-
make
public Dom make(org.glassfish.hk2.api.ServiceLocator habitat, XMLStreamReader in, T parent, ConfigModel model)
-
writeTo
public void writeTo(XMLStreamWriter w) throws XMLStreamException
Writes back the whole DOM tree as an XML document.To support writing a subtree, this method doesn't invoke the start/endDocument events. Those are the responsibility of the caller.
- Parameters:
w- Receives XML infoset stream.- Throws:
XMLStreamException
-
-