Package gda.spring

Class SpringApplicationContextBasedObjectFactory

java.lang.Object
gda.factory.ConfigurableBase
gda.factory.FactoryBase
gda.spring.SpringApplicationContextBasedObjectFactory
All Implemented Interfaces:
Configurable, Factory

public class SpringApplicationContextBasedObjectFactory extends FactoryBase
A GDA Factory that wraps a Spring ApplicationContext, providing access to all the Findables within the Spring context.
  • Constructor Details

    • SpringApplicationContextBasedObjectFactory

      public SpringApplicationContextBasedObjectFactory(org.springframework.context.ApplicationContext applicationContext)
  • Method Details

    • addFindable

      public void addFindable(Findable findable)
      Description copied from interface: Factory
      Used to add the Findables to this factory
      Parameters:
      findable - the object to add.
    • getFindables

      public List<Findable> getFindables()
      Description copied from interface: Factory
      Returns the findable objects held in this factory.
      Returns:
      the list of objects.
    • getFindableNames

      public List<String> getFindableNames()
      Description copied from interface: Factory
      Returns a list of the names of all findable objects held in this factory.
      Returns:
      a list of findable names
    • getFindable

      public <T extends Findable> T getFindable(String name) throws FactoryException
      Description copied from interface: Factory
      Return a named object from the factory or null if this factory can't provide the object.
      Type Parameters:
      T - The type of the object to find
      Parameters:
      name - the name of the object as defined by the Findable interface.
      Returns:
      the named object or null if this factory can't provide it.
      Throws:
      FactoryException
    • getFindablesOfType

      public <T extends Findable> Map<String,T> getFindablesOfType(Class<T> clazz)
      Description copied from interface: Factory
      Return all objects of the requested type from this factory.
      Type Parameters:
      T - The type of the object to find
      Parameters:
      clazz - the type of the objects to be found
      Returns:
      a map of name to requested objects that can be provided from this factory or an empty map if none can be provided
    • isLocal

      public boolean isLocal()
      Description copied from interface: Factory
      Indicates whether this factory contains objects that have been instantiated locally.
      Returns:
      whether this factory contains local objects