Package org.jvnet.hk2.config
Class ConfigBean
- java.lang.Object
-
- org.glassfish.hk2.utilities.DescriptorImpl
-
- org.glassfish.hk2.utilities.AbstractActiveDescriptor
-
- org.jvnet.hk2.config.Dom
-
- org.jvnet.hk2.config.ConfigBean
-
- All Implemented Interfaces:
Externalizable
,Serializable
,InvocationHandler
,org.glassfish.hk2.api.ActiveDescriptor
,org.glassfish.hk2.api.Descriptor
,org.glassfish.hk2.api.SingleCache
,ConfigView
,ObservableBean
- Direct Known Subclasses:
GlassFishConfigBean
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
-
-
Constructor Summary
Constructors Constructor Description ConfigBean(org.glassfish.hk2.api.ServiceLocator habitat, DomDocument document, ConfigBean parent, ConfigModel model, XMLStreamReader in)
ConfigBean(Dom source, Dom parent)
Copy constructor, used to get a deep copy of the passed instance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description 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>
Tcopy(T parent)
Returns a copy of itself providing the parent for the new copy.boolean
equals(Object o)
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 modifiedConfigBean
getMasterView()
We are the master view.ObjectName
getObjectName()
<T> T
getOptionalFeature(Class<T> featureType)
Returns an optional feature of the ConfigBean.<T extends ConfigBeanProxy>
TgetProxy(Class<T> proxyType)
Creates a proxy for this view.protected Object
getter(ConfigModel.Property target, Type t)
int
hashCode()
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, getCache, getContractTypes, getElementNames, getFactoryLocatorId, getFactoryServiceId, getHabitat, getImplementationClass, getImplementationType, getInjectees, getInjector, getKey, getLocation, getProxyType, getQualifierAnnotations, getScopeAnnotation, getServiceLocator, getSymbolSpaceRoot, initializationCompleted, inject, insertAfter, invoke, invoke, isCacheSet, isReified, leafElement, leafElements, nodeByTypeElement, nodeByTypeElements, nodeElement, nodeElements, rawAttribute, rawLeafElement, rawLeafElements, release, releaseCache, removeChild, removeLeafElement, removeListener, replaceChild, resolveReference, setCache, setImplementationType, setLeafElements, setNodeElements, skipFromXml, unwrap, writeTo, writeToXml
-
Methods inherited from class org.glassfish.hk2.utilities.AbstractActiveDescriptor
addContractType, addQualifierAnnotation, dispose, getScopeAsAnnotation, removeContractType, removeQualifierAnnotation, setFactoryId, setName, setReified, setScopeAnnotation, setScopeAsAnnotation
-
Methods inherited from class org.glassfish.hk2.utilities.DescriptorImpl
addAdvertisedContract, addMetadata, addMetadata, addQualifier, clearMetadata, descriptorEquals, getAdvertisedContracts, getClassAnalysisName, getDescriptorType, getDescriptorVisibility, getImplementation, getLoader, getLocatorId, getMetadata, getName, getQualifiers, getRanking, getScope, getServiceId, isProxiable, isProxyForSameScope, pretty, readExternal, readObject, removeAdvertisedContract, removeAllMetadata, removeMetadata, removeQualifier, setClassAnalysisName, setDescriptorType, setDescriptorVisibility, setImplementation, setLoader, setLocatorId, setMetadata, setProxiable, setProxyForSameScope, setRanking, setScope, setServiceId, toString, writeExternal, 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 org.glassfish.hk2.api.Descriptor
getAdvertisedContracts, getClassAnalysisName, getDescriptorType, getDescriptorVisibility, getImplementation, getLoader, getLocatorId, getMetadata, getName, getQualifiers, getRanking, getScope, getServiceId, isProxiable, isProxyForSameScope, setRanking
-
Methods inherited from interface java.lang.reflect.InvocationHandler
invoke
-
-
-
-
Constructor Detail
-
ConfigBean
public ConfigBean(org.glassfish.hk2.api.ServiceLocator habitat, DomDocument document, ConfigBean parent, ConfigModel model, XMLStreamReader in)
-
-
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.
-
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
-
getter
protected Object getter(ConfigModel.Property target, Type t)
-
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 interfaceConfigView
- Returns:
- the master view
-
setMasterView
public void setMasterView(ConfigView view)
- Specified by:
setMasterView
in interfaceConfigView
-
getProxy
public <T extends ConfigBeanProxy> T getProxy(Class<T> proxyType)
Creates a proxy for this view.- Specified by:
getProxy
in interfaceConfigView
- 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.
-
-