org.jvnet.hk2.config
Class ConfigBean

java.lang.Object
  extended by org.glassfish.hk2.utilities.DescriptorImpl
      extended by com.sun.hk2.component.AbstractInhabitantImpl<T>
          extended by com.sun.hk2.component.EventPublishingInhabitant<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:
ClassLoaderHolder, Holder, Serializable, InvocationHandler, ActiveDescriptor, Descriptor, SingleCache, Binding, Factory, ManagedComponentProvider, Provider, Releasable, 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
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from interface com.sun.hk2.component.Holder
Holder.Impl<T>
 
Field Summary
 
Fields inherited from class org.jvnet.hk2.config.Dom
document, model
 
Fields inherited from class com.sun.hk2.component.EventPublishingInhabitant
real
 
Fields inherited from class com.sun.hk2.component.AbstractInhabitantImpl
descriptor, logger
 
Constructor Summary
ConfigBean(Dom source, Dom parent)
          Copy constructor, used to get a deep copy of the passed instance.
ConfigBean(Habitat habitat, DomDocument document, ConfigBean parent, ConfigModel model, XMLStreamReader in)
           
 
Method Summary
 void addInterceptor(Class<?> interceptorType, ConfigBeanInterceptor interceptor)
          Add a new ConfigBeanInterceptor to this ConfigBean instance.
 ConfigBean allocate(Class<?> type)
          Allocate a new ConfigBean object as part of the Transaction associated with this configuration object.
protected
<T extends Dom>
T
copy(T parent)
          Returns a copy of itself providing the parent for the new copy.
 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 concurrently modified
 ConfigBean getMasterView()
          We are the master view.
 ObjectName getObjectName()
           
<T> T
getOptionalFeature(Class<T> featureType)
          Returns an optional feature of the ConfigBean.
<T extends ConfigBeanProxy>
T
getProxy(Class<T> proxyType)
          Creates a proxy for this view.
protected  Object getter(ConfigModel.Property target, Type t)
           
 ConfigBean parent()
          If this DOM is a child of another DOM, the parent pointer.
 void setMasterView(ConfigView view)
           
 void setObjectName(ObjectName objectNameIn)
           
protected  void setter(ConfigModel.Property target, Object value)
           
 
Methods inherited from class org.jvnet.hk2.config.Dom
addDefaultChildren, addLeafElement, addListener, attribute, attribute, attributes, changeLeafElement, convertName, create, createCreator, createProxy, createProxy, digAnnotation, digAnnotation, domNodeByTypeElements, element, get, getAttributeNames, getBaseServiceLocator, getCache, getContractTypes, getElementNames, getFactoryLocatorId, getFactoryServiceId, getHabitat, getImplementationClass, getInjectees, getInjector, getKey, getLocation, getProxyType, getQualifierAnnotations, getScopeAnnotation, getSymbolSpaceRoot, initializationCompleted, inject, injectInto, insertAfter, invoke, invoke, isCacheSet, isReified, leafElement, leafElements, nodeByTypeElement, nodeByTypeElements, nodeElement, nodeElements, rawAttribute, rawLeafElement, rawLeafElements, release, releaseCache, removeChild, removeLeafElement, removeListener, replaceChild, resolveReference, setCache, setLeafElements, setNodeElements, unwrap, writeTo
 
Methods inherited from class com.sun.hk2.component.LazyInhabitant
fetch, getClassLoader, lead, loadClass, metadata, type, type, typeName
 
Methods inherited from class com.sun.hk2.component.EventPublishingInhabitant
addInhabitantListener, equals, getServiceLocator, hashCode, isActive, notify, removeInhabitantListener, toString
 
Methods inherited from class com.sun.hk2.component.AbstractInhabitantImpl
companions, dispose, get, getAnnotation, getAnnotation, getAnnotations, getByType, getDescriptor, getDescriptorFor, getProvider, getProvider, getSerializedMetadata, getSerializedMetadata, matches, setCompanions
 
Methods inherited from class org.glassfish.hk2.utilities.DescriptorImpl
addAdvertisedContract, addMetadata, addQualifier, getAdvertisedContracts, getBaseDescriptor, getDescriptorType, getImplementation, getLoader, getLocatorId, getMetadata, getName, getQualifiers, getRanking, getScope, getServiceId, pretty, readObject, removeAdvertisedContract, removeAllMetadata, removeMetadata, removeQualifier, setBaseDescriptor, setDescriptorType, setImplementation, setLoader, setLocatorId, setName, setRanking, setScope, setServiceId, writeObject
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.jvnet.hk2.config.ConfigView
getProxyType
 
Methods inherited from interface java.lang.reflect.InvocationHandler
invoke
 
Methods inherited from interface org.glassfish.hk2.api.ActiveDescriptor
dispose
 
Methods inherited from interface org.glassfish.hk2.api.Descriptor
getAdvertisedContracts, getBaseDescriptor, getDescriptorType, getImplementation, getLoader, getLocatorId, getMetadata, getName, getQualifiers, getRanking, getScope, getServiceId, setRanking
 

Constructor Detail

ConfigBean

public ConfigBean(Habitat habitat,
                  DomDocument document,
                  ConfigBean parent,
                  ConfigModel model,
                  XMLStreamReader in)

ConfigBean

public ConfigBean(Dom source,
                  Dom parent)
Copy constructor, used to get a deep copy of the passed instance.

Parameters:
source - the instance to copy
Method Detail

getObjectName

public ObjectName getObjectName()

setObjectName

public void setObjectName(ObjectName objectNameIn)

copy

protected <T extends Dom> T copy(T parent)
Returns a copy of itself providing the parent for the new copy.

Overrides:
copy in class Dom
Parameters:
parent - the parent instance for the cloned copy
Returns:
the cloned copy

getOptionalFeature

public <T> T getOptionalFeature(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,
                      Object value)
               throws Exception
Overrides:
setter in class Dom
Throws:
Exception

getter

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

addInterceptor

public void addInterceptor(Class<?> interceptorType,
                           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:
interceptorType - type of the type interceptor.
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(Class<T> proxyType)
Creates a proxy for this view.

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

allocate

public ConfigBean allocate(Class<?> type)
Allocate a new ConfigBean object as part of the Transaction associated with this configuration object. This will eventually be moved to a factory.

Parameters:
type - the request configuration object type
Returns:
the properly constructed configuration object

getLock

public 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 concurrently modified

Returns:
lock instance

parent

public ConfigBean parent()
Description copied from class: Dom
If this DOM is a child of another DOM, the parent pointer. Otherwise null.

Overrides:
parent in class Dom


Copyright © 2013 Oracle Corporation. All Rights Reserved.