Class ReflectiveDynamicAccess


  • public class ReflectiveDynamicAccess
    extends DynamicAccess
    This is the default pekko.actor.DynamicAccess implementation used by pekko.actor.ExtendedActorSystem unless overridden. It uses reflection to turn fully-qualified class names into Class[_] objects and creates instances from there using getDeclaredConstructor() and invoking that. The class loader to be used for all this is determined by the actor system’s class loader by default.

    Not for user extension or construction

    • Constructor Summary

      Constructors 
      Constructor Description
      ReflectiveDynamicAccess​(java.lang.ClassLoader classLoader)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean classIsOnClasspath​(java.lang.String fqcn)  
      java.lang.ClassLoader classLoader()
      This is the class loader to be used in those special cases where the other factory method are not applicable (e.g.
      <T> scala.util.Try<T> createInstanceFor​(java.lang.Class<?> clazz, scala.collection.immutable.Seq<scala.Tuple2<java.lang.Class<?>,​java.lang.Object>> args, scala.reflect.ClassTag<T> evidence$2)
      Convenience method which given a Class[_] object and a constructor description will create a new instance of that class.
      <T> scala.util.Try<T> createInstanceFor​(java.lang.String fqcn, scala.collection.immutable.Seq<scala.Tuple2<java.lang.Class<?>,​java.lang.Object>> args, scala.reflect.ClassTag<T> evidence$3)
      Obtain an object conforming to the type T, which is expected to be instantiated from a class designated by the fully-qualified class name given, where the constructor is selected and invoked according to the args argument.
      <T> scala.util.Try<java.lang.Class<? extends T>> getClassFor​(java.lang.String fqcn, scala.reflect.ClassTag<T> evidence$1)
      Obtain a Class[_] object loaded with the right class loader (i.e.
      <T> scala.util.Try<T> getObjectFor​(java.lang.String fqcn, scala.reflect.ClassTag<T> evidence$4)
      Obtain the Scala &ldquo;object&rdquo; instance for the given fully-qualified class name, if there is one.
      • Methods inherited from class java.lang.Object

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

      • ReflectiveDynamicAccess

        public ReflectiveDynamicAccess​(java.lang.ClassLoader classLoader)
    • Method Detail

      • classLoader

        public java.lang.ClassLoader classLoader()
        Description copied from class: DynamicAccess
        This is the class loader to be used in those special cases where the other factory method are not applicable (e.g. when constructing a ClassLoaderBinaryInputStream).
        Specified by:
        classLoader in class DynamicAccess
      • createInstanceFor

        public <T> scala.util.Try<T> createInstanceFor​(java.lang.Class<?> clazz,
                                                       scala.collection.immutable.Seq<scala.Tuple2<java.lang.Class<?>,​java.lang.Object>> args,
                                                       scala.reflect.ClassTag<T> evidence$2)
        Description copied from class: DynamicAccess
        Convenience method which given a Class[_] object and a constructor description will create a new instance of that class.

        
         val obj = DynamicAccess.createInstanceFor(clazz, Seq(classOf[Config] -> config, classOf[String] -> name))
         
        Specified by:
        createInstanceFor in class DynamicAccess
      • createInstanceFor

        public <T> scala.util.Try<T> createInstanceFor​(java.lang.String fqcn,
                                                       scala.collection.immutable.Seq<scala.Tuple2<java.lang.Class<?>,​java.lang.Object>> args,
                                                       scala.reflect.ClassTag<T> evidence$3)
        Description copied from class: DynamicAccess
        Obtain an object conforming to the type T, which is expected to be instantiated from a class designated by the fully-qualified class name given, where the constructor is selected and invoked according to the args argument. The exact usage of args depends on which type is requested, see the relevant requesting code for details.
        Specified by:
        createInstanceFor in class DynamicAccess
      • getClassFor

        public <T> scala.util.Try<java.lang.Class<? extends T>> getClassFor​(java.lang.String fqcn,
                                                                            scala.reflect.ClassTag<T> evidence$1)
        Description copied from class: DynamicAccess
        Obtain a Class[_] object loaded with the right class loader (i.e. the one returned by classLoader).
        Specified by:
        getClassFor in class DynamicAccess
      • getObjectFor

        public <T> scala.util.Try<T> getObjectFor​(java.lang.String fqcn,
                                                  scala.reflect.ClassTag<T> evidence$4)
        Description copied from class: DynamicAccess
        Obtain the Scala &ldquo;object&rdquo; instance for the given fully-qualified class name, if there is one.
        Specified by:
        getObjectFor in class DynamicAccess