Class Provider


  • public final class Provider
    extends java.lang.Object
    OpenCensus service provider mechanism.
    
     // Initialize a variable using reflection.
     foo = Provider.createInstance(
         Class.forName("FooImpl", true, classLoader), Foo.class);
     
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      private Provider()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static <T> T createInstance​(java.lang.Class<?> rawClass, java.lang.Class<T> superclass)
      Tries to create an instance of the given rawClass as a subclass of the given superclass.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • Provider

        private Provider()
    • Method Detail

      • createInstance

        public static <T> T createInstance​(java.lang.Class<?> rawClass,
                                           java.lang.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:
        java.util.ServiceConfigurationError - if any error happens.