Package org.apache.pekko.actor
Class ReflectiveDynamicAccess
- java.lang.Object
-
- org.apache.pekko.actor.DynamicAccess
-
- org.apache.pekko.actor.ReflectiveDynamicAccess
-
public class ReflectiveDynamicAccess extends DynamicAccess
This is the defaultpekko.actor.DynamicAccess
implementation used bypekko.actor.ExtendedActorSystem
unless overridden. It uses reflection to turn fully-qualified class names intoClass[_]
objects and creates instances from there usinggetDeclaredConstructor()
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 aClass[_]
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 theargs
argument.<T> scala.util.Try<java.lang.Class<? extends T>>
getClassFor(java.lang.String fqcn, scala.reflect.ClassTag<T> evidence$1)
Obtain aClass[_]
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 “object” instance for the given fully-qualified class name, if there is one.
-
-
-
Method Detail
-
classIsOnClasspath
public boolean classIsOnClasspath(java.lang.String fqcn)
- Specified by:
classIsOnClasspath
in classDynamicAccess
-
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 classDynamicAccess
-
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 aClass[_]
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 classDynamicAccess
-
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 theargs
argument. The exact usage of args depends on which type is requested, see the relevant requesting code for details.- Specified by:
createInstanceFor
in classDynamicAccess
-
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 aClass[_]
object loaded with the right class loader (i.e. the one returned byclassLoader
).- Specified by:
getClassFor
in classDynamicAccess
-
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 “object” instance for the given fully-qualified class name, if there is one.- Specified by:
getObjectFor
in classDynamicAccess
-
-