Package io.opencensus.internal
Class Provider
java.lang.Object
io.opencensus.internal.Provider
OpenCensus service provider mechanism.
// Initialize a variable using reflection.
foo = Provider.createInstance(
Class.forName("FooImpl", true, classLoader), Foo.class);
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic <T> T
createInstance
(Class<?> rawClass, Class<T> superclass) Tries to create an instance of the given rawClass as a subclass of the given superclass.
-
Constructor Details
-
Provider
private Provider()
-
-
Method Details
-
createInstance
Tries to create an instance of the given rawClass as a subclass of the given superclass.- Parameters:
rawClass
- The class that is initialized.superclass
- The initialized class must be a subclass of this.- Returns:
- an instance of the class given rawClass which is a subclass of the given superclass.
- Throws:
ServiceConfigurationError
- if any error happens.
-