org.jvnet.hk2.config
Class DomDocument<T extends Dom>

java.lang.Object
  extended by org.jvnet.hk2.config.DomDocument<T>

public class DomDocument<T extends Dom>
extends Object

Represents a whole DOM tree.

Author:
Kohsuke Kawaguchi

Field Summary
protected  Map<Inhabitant<? extends ConfigInjector>,ConfigModel> models
           
 
Constructor Summary
DomDocument(Habitat habitat)
           
 
Method Summary
 ConfigModel buildModel(Class<?> clazz)
          Obtains a ConfigModel for the given class (Which should have Configured annotation on it.)
 ConfigModel buildModel(String fullyQualifiedClassName)
          Obtains a ConfigModel for the given class (Which should have Configured annotation on it.)
 List<ConfigModel> getAllModelsImplementing(Class intf)
          Calculates all @Configured interfaces subclassing the passed interface type.
 ConfigModel getModel(Class c)
          Deprecated. 
 ConfigModel getModelByElementName(String elementName)
          Obtains the ConfigModel from the "global" element name.
 Dom getRoot()
           
 Translator getTranslator()
           
 Dom make(Habitat habitat, XMLStreamReader in, T parent, ConfigModel model)
           
 void setTranslator(Translator translator)
           
 void writeTo(XMLStreamWriter w)
          Writes back the whole DOM tree as an XML document.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

models

protected final Map<Inhabitant<? extends ConfigInjector>,ConfigModel> models
Constructor Detail

DomDocument

public DomDocument(Habitat habitat)
Method Detail

getRoot

public Dom getRoot()

getTranslator

public Translator getTranslator()

setTranslator

public void setTranslator(Translator translator)

buildModel

public ConfigModel buildModel(Class<?> clazz)
Obtains a ConfigModel for the given class (Which should have Configured annotation on it.)


buildModel

public ConfigModel buildModel(String fullyQualifiedClassName)
Obtains a ConfigModel for the given class (Which should have Configured annotation on it.)


getModelByElementName

public ConfigModel getModelByElementName(String elementName)
Obtains the ConfigModel from the "global" element name.

This method uses buildModel(org.jvnet.hk2.component.Inhabitant) 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(Habitat 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


Copyright © 2013 Oracle Corporation. All Rights Reserved.