Class ReflectiveDynamicAccess

java.lang.Object
org.apache.pekko.actor.DynamicAccess
org.apache.pekko.actor.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
     
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
     
    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(Class<?> clazz, scala.collection.immutable.Seq<scala.Tuple2<Class<?>,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(String fqcn, scala.collection.immutable.Seq<scala.Tuple2<Class<?>,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<Class<? extends T>>
    getClassFor(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(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 Details

    • ReflectiveDynamicAccess

      public ReflectiveDynamicAccess(ClassLoader classLoader)
  • Method Details

    • classIsOnClasspath

      public boolean classIsOnClasspath(String fqcn)
      Specified by:
      classIsOnClasspath in class DynamicAccess
    • classLoader

      public 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(Class<?> clazz, scala.collection.immutable.Seq<scala.Tuple2<Class<?>,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(String fqcn, scala.collection.immutable.Seq<scala.Tuple2<Class<?>,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<Class<? extends T>> getClassFor(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(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