Class Provider

java.lang.Object
io.opencensus.internal.Provider

public final class Provider extends Object
OpenCensus service provider mechanism.

 // Initialize a variable using reflection.
 foo = Provider.createInstance(
     Class.forName("FooImpl", true, classLoader), Foo.class);
 
  • Constructor Details

    • Provider

      private Provider()
  • Method Details

    • createInstance

      public static <T> T createInstance(Class<?> rawClass, Class<T> superclass)
      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.