Class InstanceAdapter<T>

    • Method Detail

      • getComponentInstance

        public T getComponentInstance​(PicoContainer container,
                                      java.lang.reflect.Type into)
        Description copied from interface: ComponentAdapter
        Retrieve the component instance. This method will usually create a new instance each time it is called, but that is not required. For example, Cached will always return the same instance.
        Specified by:
        getComponentInstance in interface ComponentAdapter<T>
        Parameters:
        container - the PicoContainer, that is used to resolve any possible dependencies of the instance.
        into - the class that is about to be injected into. Use ComponentAdapter.NOTHING.class if this is not important to you.
        Returns:
        the component instance.
      • verify

        public void verify​(PicoContainer container)
        Description copied from interface: ComponentAdapter
        Verify that all dependencies for this adapter can be satisfied. Normally, the adapter should verify this by checking that the associated PicoContainer contains all the needed dependencies.
        Specified by:
        verify in interface ComponentAdapter<T>
        Parameters:
        container - the PicoContainer, that is used to resolve any possible dependencies of the instance.
      • getDescriptor

        public java.lang.String getDescriptor()
        Description copied from interface: ComponentAdapter
        Get a string key descriptor of the component adapter for use in toString()
        Specified by:
        getDescriptor in interface ComponentAdapter<T>
        Returns:
        the descriptor
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class AbstractAdapter<T>
        Returns:
        Returns the ComponentAdapter's class name and the component's key.
        See Also:
        Object.toString()
      • start

        public void start​(PicoContainer container)
        Description copied from interface: ComponentLifecycle
        Invoke the "start" method on the component.
        Specified by:
        start in interface ComponentLifecycle<T>
        Parameters:
        container - the container to "start" the component
      • stop

        public void stop​(PicoContainer container)
        Description copied from interface: ComponentLifecycle
        Invoke the "stop" method on the component.
        Specified by:
        stop in interface ComponentLifecycle<T>
        Parameters:
        container - the container to "stop" the component
      • dispose

        public void dispose​(PicoContainer container)
        Description copied from interface: ComponentLifecycle
        Invoke the "dispose" method on the component.
        Specified by:
        dispose in interface ComponentLifecycle<T>
        Parameters:
        container - the container to "dispose" the component
      • start

        public void start​(java.lang.Object component)
        Description copied from interface: LifecycleStrategy
        Invoke the "start" method on the component instance if this is startable. It is up to the implementation of the strategy what "start" and "startable" means.
        Specified by:
        start in interface LifecycleStrategy
        Parameters:
        component - the instance of the component to start
      • stop

        public void stop​(java.lang.Object component)
        Description copied from interface: LifecycleStrategy
        Invoke the "stop" method on the component instance if this is stoppable. It is up to the implementation of the strategy what "stop" and "stoppable" means.
        Specified by:
        stop in interface LifecycleStrategy
        Parameters:
        component - the instance of the component to stop
      • dispose

        public void dispose​(java.lang.Object component)
        Description copied from interface: LifecycleStrategy
        Invoke the "dispose" method on the component instance if this is disposable. It is up to the implementation of the strategy what "dispose" and "disposable" means.
        Specified by:
        dispose in interface LifecycleStrategy
        Parameters:
        component - the instance of the component to dispose
      • hasLifecycle

        public boolean hasLifecycle​(java.lang.Class<?> type)
        Description copied from interface: LifecycleStrategy
        Test if a component instance has a lifecycle.
        Specified by:
        hasLifecycle in interface LifecycleStrategy
        Parameters:
        type - the component's type
        Returns:
        true if the component has a lifecycle
      • isLazy

        public boolean isLazy​(ComponentAdapter<?> adapter)
        Description copied from interface: LifecycleStrategy
        Is a component eager (not lazy) in that it should start when start() or equivalent is called, or lazy (it will only start on first getComponent() ). The default is the first of those two.
        Specified by:
        isLazy in interface LifecycleStrategy
        Returns:
        true if lazy, false if not lazy