Interface IRegistry

All Superinterfaces:
Serializable
All Known Implementing Classes:
QFSRegistry

public interface IRegistry extends Serializable
Base interface of a ActiveViam Registry Provides method to instantiate Types and retrieve plugins.
Author:
ActiveViam
  • Method Summary

    Modifier and Type
    Method
    Description
    <T, U extends T>
    U
    create(Class<T> interfaceClass, Object... initParams)
    Creates a new instance of a type identified by its interface, with the supplied parameters.
    <T extends IExtendedPluginValue, U extends T>
    IExtendedPlugin<U>
    getExtendedPlugin(Class<T> interfaceClass)
    Returns the extended plugin instance registered with the extended plugin value interface.
    Gets the name of this instance of Registry.
    <T extends IPluginValue, U extends T>
    IPlugin<U>
    getPlugin(Class<T> interfaceClass)
    Returns the plugin instance registered with the plugin value interface.
    <T, U extends T>
    IFactory<U>
    Return the factory used by this registry to instantiate types of the given interface.
    Gets the type interface the implementation class may be associated with.
    void
    Sets the name of the registry.
    default <T, U extends T>
    void
    setType(Class<T> intf, Class<U> impl)
    Defines an Atoti type.
  • Method Details

    • getName

      String getName()
      Gets the name of this instance of Registry.
      Returns:
      name of the registry
    • setName

      void setName(String name)
      Sets the name of the registry.
      Parameters:
      name - The new name of the registry.
    • create

      <T, U extends T> U create(Class<T> interfaceClass, Object... initParams)
      Creates a new instance of a type identified by its interface, with the supplied parameters.
      Type Parameters:
      T - Type of the interface class
      U - the type of the interface, including generic parameters if any
      Parameters:
      interfaceClass - The interface of which to create an instance of.
      initParams - The parameters to create the instance with.
      Returns:
      new instance of the Type
    • getPlugin

      <T extends IPluginValue, U extends T> IPlugin<U> getPlugin(Class<T> interfaceClass)
      Returns the plugin instance registered with the plugin value interface.
      Type Parameters:
      T - the type of the interface.
      U - the type of the interface, including generic parameters if any
      Parameters:
      interfaceClass - The interface for which to retrieve the plugin.
      Returns:
      plugin instance
    • getExtendedPlugin

      <T extends IExtendedPluginValue, U extends T> IExtendedPlugin<U> getExtendedPlugin(Class<T> interfaceClass)
      Returns the extended plugin instance registered with the extended plugin value interface.
      Type Parameters:
      T - the type of the interface.
      U - expected type of the plugin. This is set mainly to correctly support extended plugin for generic interfaces, such as ExtendedPlugin<Collection<?>> e = getExtendedPlugin(Collection.class).
      Parameters:
      interfaceClass - The interface for which to retrieve the extended plugin.
      Returns:
      extended plugin instance
    • getTypeFactory

      <T, U extends T> IFactory<U> getTypeFactory(Class<T> intf)
      Return the factory used by this registry to instantiate types of the given interface. Returns null if the interface does not define a valid type.
      Type Parameters:
      T - the type of the interface.
      U - Type of the interface including generic parameters if any
      Parameters:
      intf - The interface for which to retrieve the type factory.
      Returns:
      type factory
    • getTypeInterface

      Class<?> getTypeInterface(Class<?> impl)
      Gets the type interface the implementation class may be associated with.
      Parameters:
      impl - implementation class
      Returns:
      the type
    • setType

      default <T, U extends T> void setType(Class<T> intf, Class<U> impl)
      Defines an Atoti type.

      For a given interface, this sets a corresponding implementation. After this call, it will be possible to call create(Class, Object...), passing the interface and constructor arguments to create instances for the bound type.

      If an implementation class is already assigned to the interface, this call replaces the previous value with the provided implementation class.

      Type Parameters:
      T - Type of the interface class
      U - Type of the implementation class