Package kieker.common.util.classpath
Class InstantiationFactory
java.lang.Object
kieker.common.util.classpath.InstantiationFactory
public final class InstantiationFactory
extends java.lang.Object
This class encapsulates the creation of Kieker monitoring controllers.
- Since:
- 1.15
- Author:
- Holger Knoche, Reiner Jung
-
Method Summary
Modifier and Type Method Description <C> C
create(java.lang.Class<C> c, java.lang.String className, java.lang.Class<?>[] parameterTypes, java.lang.Object... parameters)
This is a helper method .<C> C
createAndInitialize(java.lang.Class<C> c, java.lang.String className, Configuration configuration)
This is a helper method trying to find, create and initialize the given class, using its public constructor which accepts a singleConfiguration
.static <C> C
createWithConfiguration(java.lang.Class<C> implementedInterface, java.lang.String className, Configuration configuration)
This is a helper method trying to find, create and initialize the given class, using its public constructor which accepts a singleConfiguration
.static InstantiationFactory
getInstance(Configuration configuration)
Get an instance of the controller factory for the given configuration.
-
Method Details
-
getInstance
Get an instance of the controller factory for the given configuration.- Parameters:
configuration
- The configuration to use- Returns:
- A controller factory instance
-
createAndInitialize
public <C> C createAndInitialize(java.lang.Class<C> c, java.lang.String className, Configuration configuration)This is a helper method trying to find, create and initialize the given class, using its public constructor which accepts a singleConfiguration
.- Type Parameters:
C
- The type of the returned class.- Parameters:
c
- This class defines the expected result of the method call.className
- The name of the class to be created.configuration
- The configuration which will be used to initialize the class in question.- Returns:
- A new and initializes class instance if everything went well.
-
createWithConfiguration
public static <C> C createWithConfiguration(java.lang.Class<C> implementedInterface, java.lang.String className, Configuration configuration) throws ConfigurationExceptionThis is a helper method trying to find, create and initialize the given class, using its public constructor which accepts a singleConfiguration
.- Type Parameters:
C
- The type of the returned class.- Parameters:
implementedInterface
- This class defines the expected result of the method call.className
- The name of the class to be created.configuration
- The configuration which will be used to initialize the class in question.- Returns:
- A new and initializes class instance if everything went well.
- Throws:
ConfigurationException
- on configuration errors during instantiation
-
create
public <C> C create(java.lang.Class<C> c, java.lang.String className, java.lang.Class<?>[] parameterTypes, java.lang.Object... parameters)This is a helper method .- Type Parameters:
C
- The type of the returned class.- Parameters:
c
- This class defines the expected result of the method call.className
- The name of the class to be created.parameterTypes
- types of the parametersparameters
- parameter for the constructor- Returns:
- A new and initializes class instance if everything went well.
-