Class AbstractRegistry.InstanceInformation

  • Direct Known Subclasses:
    ServiceInformation
    Enclosing class:
    AbstractRegistry

    public static class AbstractRegistry.InstanceInformation
    extends Object
    InstanceInformation encapsulates the properties from the configuration relevant for a component instance. Per component instance a 3-tuple is stored: component type, instantiation mode and implementation class or implementation object. This class realises the triple (one of the four fields being null.

    Subclasses of the registry may extend this class, and override

    Author:
    Ulrich Kreher
    • Field Detail

      • componentType

        protected final String componentType
        The type of the component instance, that is the type name in the configuration.
      • implementationClass

        protected final String implementationClass
        The class (full name) which is used as implementation for the instance. It is assured that this class implements the corresponding component type interface. This will be null in case the implementation is provided directly (injected into the configuration).
      • implementation

        protected final Object implementation
        The object used as implementation for the instance. This is usually provided via the configuration by injecting it there as implementation. It is assured that this object implements the corresponding component type interface. This will be null in case no object is provided but the corresponding implementation class.
      • implInitialised

        protected boolean implInitialised
        Whether the provided implementation been initialised. Initialisation is used similar to the constructor of an instance provided by its class name.
    • Constructor Detail

      • InstanceInformation

        protected InstanceInformation​(String componentType,
                                      AbstractRegistry.InstantiationMode instantiationMode,
                                      String implementationClass)
        Creates a new 3-tuple with the configured component instance properties for an instance specified via its implementation class.
        Parameters:
        componentType - The type of the component instance as specified in the configuration.
        instantiationMode - The configured instantiation mode of the corresponding component instance.
        implementationClass - The implementation (class name) to use for the component instance which conforms to the corresponding component type interface.
      • InstanceInformation

        protected InstanceInformation​(String componentType,
                                      Object implementation)
        Creates a new 3-tuple with the configured component instance properties for an instance specified via an injected implementation. Such an instance is always singleton.
        Parameters:
        componentType - The type of the component instance as specified in the configuration.
        implementation - The object to use for the component instance which conforms to the corresponding component type interface.
    • Method Detail

      • isInstantiated

        public boolean isInstantiated()
        Gets whether this instance is provided (injected) as object and therefore need not be created by the registry.
        Returns:
        Whether this instance is provided (injected) as object.
      • getImplementationClass

        public String getImplementationClass()
        Gets the class (full name) which is used as implementation for the instance. It is assured that this class implements the corresponding component type interface.
        Returns:
        The name of the class of the instance.
      • instantiatedInitRequired

        public boolean instantiatedInitRequired()
        Whether this instance is provided (injected) as object and has not been initialised yet. Initialisation is used similar to the constructor of an instance provided by its class name.
        Returns:
        Whether this instance is provided (injected) and has not been initialised yet.
      • instantiatedInitialised

        public void instantiatedInitialised()
        Sets this provided (injected) instance as initialised. Initialisation is used similar to the constructor of an instance provided by its class name.