org.jvnet.hk2.config
Class ConfigBean

java.lang.Object
  extended by com.sun.hk2.component.AbstractInhabitantImpl<T>
      extended by com.sun.hk2.component.LazyInhabitant
          extended by org.jvnet.hk2.config.Dom
              extended by org.jvnet.hk2.config.ConfigBean
All Implemented Interfaces:
com.sun.hk2.component.Holder, java.lang.reflect.InvocationHandler, org.jvnet.hk2.component.Inhabitant, ConfigView, ObservableBean

public class ConfigBean
extends Dom
implements ConfigView

ConfigBean is the core implementation of the config beans. It has features like locking view creation and optional features attachement.

Author:
Jerome Dochez

Nested Class Summary
 
Nested classes/interfaces inherited from interface com.sun.hk2.component.Holder
com.sun.hk2.component.Holder.Impl<T>
 
Field Summary
 
Fields inherited from class org.jvnet.hk2.config.Dom
document, model
 
Fields inherited from class com.sun.hk2.component.LazyInhabitant
habitat
 
Constructor Summary
ConfigBean(org.jvnet.hk2.component.Habitat habitat, DomDocument document, Dom parent, ConfigModel model, javax.xml.stream.XMLStreamReader in)
           
 
Method Summary
 void addInterceptor(ConfigBeanInterceptor interceptor)
          Add a new ConfigBeanInterceptor to this ConfigBean instance.
 org.jvnet.hk2.component.Habitat getHabitat()
           
 java.util.concurrent.locks.Lock getLock()
          Returns the lock on this object, only one external view (usually the writeable view) can acquire the lock ensuring that the objects cannot be concurrentely modified
 ConfigBean getMasterView()
          We are the master view.
 javax.management.ObjectName getObjectName()
           
<T> T
getOptionalFeature(java.lang.Class<T> featureType)
          Returns an optional feature of the ConfigBean.
<T extends ConfigBeanProxy>
T
getProxy(java.lang.Class<T> proxyType)
          Creates a proxy for this view.
protected  java.lang.Object getter(ConfigModel.Property target, java.lang.reflect.Type t)
           
 void setMasterView(ConfigView view)
           
 void setObjectName(javax.management.ObjectName objectNameIn)
           
protected  void setter(ConfigModel.Property target, java.lang.Object value)
           
 
Methods inherited from class org.jvnet.hk2.config.Dom
addLeafElement, addListener, attribute, attribute, attributes, changeLeafElement, convertName, createProxy, createProxy, createWomb, digAnnotation, digAnnotation, domNodeByTypeElements, element, getAttributeNames, getElementNames, getInjector, getKey, getLocation, getProxyType, getSymbolSpaceRoot, initializationCompleted, inject, injectInto, insertAfter, invoke, invoke, leafElement, leafElements, nodeByTypeElement, nodeByTypeElements, nodeElement, nodeElements, parent, rawAttribute, rawLeafElement, rawLeafElements, release, removeChild, removeLeafElement, removeListener, replaceChild, resolveReference, setLeafElements, setNodeElements, unwrap, writeTo
 
Methods inherited from class com.sun.hk2.component.LazyInhabitant
get, metadata, type, typeName
 
Methods inherited from class com.sun.hk2.component.AbstractInhabitantImpl
companions, get, getSerializedMetadata, getSerializedMetadata, lead, setCompanions
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.jvnet.hk2.config.ConfigView
getProxyType
 
Methods inherited from interface java.lang.reflect.InvocationHandler
invoke
 

Constructor Detail

ConfigBean

public ConfigBean(org.jvnet.hk2.component.Habitat habitat,
                  DomDocument document,
                  Dom parent,
                  ConfigModel model,
                  javax.xml.stream.XMLStreamReader in)
Method Detail

getObjectName

public javax.management.ObjectName getObjectName()

setObjectName

public void setObjectName(javax.management.ObjectName objectNameIn)

getHabitat

public org.jvnet.hk2.component.Habitat getHabitat()

getOptionalFeature

public <T> T getOptionalFeature(java.lang.Class<T> featureType)
Returns an optional feature of the ConfigBean. Optional features are implemented by other objects and attached to this instance. Attached features can be queried using the getOptionalFeature method giving the type of the requestion optional feature.

Parameters:
featureType - type of the optional feature requested.
Returns:
optional feature implementation is one is attached to this instance

setter

protected void setter(ConfigModel.Property target,
                      java.lang.Object value)
               throws java.lang.Exception
Overrides:
setter in class Dom
Throws:
java.lang.Exception

getter

protected java.lang.Object getter(ConfigModel.Property target,
                                  java.lang.reflect.Type t)
Overrides:
getter in class Dom

addInterceptor

public void addInterceptor(ConfigBeanInterceptor interceptor)
Add a new ConfigBeanInterceptor to this ConfigBean instance. The inteceptor will be called each time a attribute of this bean is accessed.

Parameters:
interceptor - the new interceptor

getMasterView

public ConfigBean getMasterView()
We are the master view.

Specified by:
getMasterView in interface ConfigView
Returns:
the master view

setMasterView

public void setMasterView(ConfigView view)
Specified by:
setMasterView in interface ConfigView

getProxy

public <T extends ConfigBeanProxy> T getProxy(java.lang.Class<T> proxyType)
Creates a proxy for this view.

Specified by:
getProxy in interface ConfigView
Parameters:
proxyType - requested proxy type
Returns:
Java SE proxy

getLock

public java.util.concurrent.locks.Lock getLock()
Returns the lock on this object, only one external view (usually the writeable view) can acquire the lock ensuring that the objects cannot be concurrentely modified

Returns:
lock instance


Copyright © 2009 Sun Microsystems, Inc.. All Rights Reserved.