Interface IFactory

All Known Implementing Classes:
CompositeFactory, DefaultCacheFactory, DefaultConfigReaderFactory, DefaultCountersFactory, DefaultCredentialStoreFactory, DefaultDiscoveryFactory, DefaultInfoFactory, DefaultLoggerFactory, Factory

public interface IFactory
Interface for component factories.

Factories use locators to identify components to be created.

The locators are similar to those used to locate components in references. They can be of any type like strings or integers. However Pip.Services toolkit most often uses Descriptor objects as component locators.

  • Method Summary

    Modifier and Type Method Description
    Object canCreate​(Object locator)
    Checks if this factory is able to create component by given locator.
    Object create​(Object locator)
    Creates a component identified by given locator.
  • Method Details

    • canCreate

      Object canCreate​(Object locator)
      Checks if this factory is able to create component by given locator. This method searches for all registered components and returns a locator for component it is able to create that matches the given locator. If the factory is not able to create a requested component is returns null.
      Parameters:
      locator - a locator to identify component to be created.
      Returns:
      a locator for a component that the factory is able to create.
    • create

      Object create​(Object locator) throws CreateException
      Creates a component identified by given locator.
      Parameters:
      locator - a locator to identify component to be created.
      Returns:
      the created component.
      Throws:
      CreateException - if the factory is not able to create the component.