All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.remondis.limbus.system.ObjectFactory Maven / Gradle / Ivy

Go to download

The Limbus System is a small light-weight CDI framework managing the Limbus Core Components. The object graph is represented by an XML configuration file or can be build using the Limbus System API. This module delivers an optional system component that visualizes the object graph and its dependencies after initializing: com.remondis.limbus.system.visualize.LimbusSystemVisualizer This component can be added to the Limbus System. To keep the dependencies of this module transparent and light-weight, the graph renderer is declared as an optional dependency. Add the following dependencies to your project to use the visualisation component: <!-- Graph Stream for Visualization feature This is an optional dependency and only required if using the com.remondis.limbus.system.visualize.LimbusSystemVisualizer --> <dependency> <groupId>org.graphstream</groupId> <artifactId>gs-core</artifactId> <version>1.3</version> </dependency> <dependency> <groupId>org.graphstream</groupId> <artifactId>gs-ui</artifactId> <version>1.3</version> </dependency>

There is a newer version: 3.1.0
Show newest version
package com.remondis.limbus.system;

import com.remondis.limbus.IInitializable;
import com.remondis.limbus.utils.ObjectCreateException;

/**
 * This interface defines an object factory that is used by the {@link LimbusSystem} to create objects.
 *
 * @author schuettec
 *
 */
public interface ObjectFactory {

  /**
   * Creates a new instance of a public component.
   *
   * @param requestType
   *        The request type the created instance is returned as, must be a super type of the implementation type.
   * @param implementationType
   *        The implementation type to instantiate.
   * @return Returns the created object casted to the specified super type.
   * @throws ObjectCreateException
   *         Thrown if the object creation failed.
   * @throws SecurityException
   *         Thrown if the runtime does not grant the permissions to reflectively create an object.
   */
  public IInitializable createObject(Class> requestType,
      Class> implementationType) throws ObjectCreateException;

  /**
   * Creates a new instance of a private component.
   *
   * @param implementationType
   *        the type to instantiate
   * @return Returns the created object casted to the specified super type.
   * @throws ObjectCreateException
   *         Thrown if the object creation failed.
   * @throws SecurityException
   *         Thrown if the runtime does not grant the permissions to reflectively create an object.
   */
  public IInitializable createObject(Class> implementationType)
      throws ObjectCreateException;

  /**
   * Called by {@link LimbusSystem} to create a reference to the specified public component. Gives object factories the
   * chance to create a proxy object.
   *
   * @param requestType
   *        The request type of the public component
   * @param componentType
   *        The component implementation type
   * @param instance
   *        The original instance of the component
   * @return Returns an object that is used to access the component instance. Implementations may return proxy objects
   *         here.
   */
  public default IInitializable createPublicReference(Class> requestType,
      Class> componentType, IInitializable instance) {
    return instance;
  }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy