Package org.apache.pekko.actor
Class ReflectiveDynamicAccess
java.lang.Object
org.apache.pekko.actor.DynamicAccess
org.apache.pekko.actor.ReflectiveDynamicAccess
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 -
Method Summary
Modifier and TypeMethodDescriptionbooleanclassIsOnClasspath(String fqcn) 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 aClass[_]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 theargsargument.<T> scala.util.Try<Class<? extends T>>getClassFor(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(String fqcn, scala.reflect.ClassTag<T> evidence$4) Obtain the Scala “object” instance for the given fully-qualified class name, if there is one.
-
Constructor Details
-
ReflectiveDynamicAccess
-
-
Method Details
-
classIsOnClasspath
- Specified by:
classIsOnClasspathin classDynamicAccess
-
classLoader
Description copied from class:DynamicAccessThis 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:
classLoaderin classDynamicAccess
-
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:DynamicAccessConvenience 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:
createInstanceForin classDynamicAccess
-
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:DynamicAccessObtain 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 theargsargument. The exact usage of args depends on which type is requested, see the relevant requesting code for details.- Specified by:
createInstanceForin classDynamicAccess
-
getClassFor
public <T> scala.util.Try<Class<? extends T>> getClassFor(String fqcn, scala.reflect.ClassTag<T> evidence$1) Description copied from class:DynamicAccessObtain aClass[_]object loaded with the right class loader (i.e. the one returned byclassLoader).- Specified by:
getClassForin classDynamicAccess
-
getObjectFor
Description copied from class:DynamicAccessObtain the Scala “object” instance for the given fully-qualified class name, if there is one.- Specified by:
getObjectForin classDynamicAccess
-