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

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:
  • Constructor Details

    • ConfigBean

      public ConfigBean(org.glassfish.hk2.api.ServiceLocator 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 Details

    • 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
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Dom
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Dom
    • 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