org.richfaces.application

## Interface ServicesFactory

- All Known Implementing Classes:
    ServicesFactoryImpl

      public interface ServicesFactory

  Allows to store instances of service interfaces of given types.

  Author:
    asmirnov@exadel.com

- - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `<T> T` | `getInstance(Class<T> type)` Get service instance associated with given type, usually service interface or base abstract class.
    `void` | `release()` Release all services.
    `<T> void` | `setInstance(Class<T> type, T instance)` Associate concrete instance with service.

- - ### Method Detail

    - #### getInstance

          <T> T getInstance(Class<T> type)
                        throws ServiceException

      Get service instance associated with given type, usually service interface or base abstract class.

      Type Parameters:
        `T` - service type.
      Parameters:
        `type` - Base class implemented by service.
      Returns:
        Current service implementation.
      Throws:
        `ServiceException` - if factory cannot create requested service.

    - #### setInstance

          <T> void setInstance(Class<T> type,
                             T instance)

      Associate concrete instance with service.

      Type Parameters:
        `T` - service type.
      Parameters:
        `type` - Base class implemented by service.
        `instance` - service instance.

    - #### release

          void release()

      Release all services.

Copyright © 2014 JBoss by Red Hat. All Rights Reserved.