akka.actor
Class ReflectiveDynamicAccess

java.lang.Object
  extended by akka.actor.DynamicAccess
      extended by akka.actor.ReflectiveDynamicAccess

public class ReflectiveDynamicAccess
extends DynamicAccess

This is the default DynamicAccess implementation used by 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.


Constructor Summary
ReflectiveDynamicAccess(java.lang.ClassLoader classLoader)
           
 
Method Summary
 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$6)
          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$7)
          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$5)
          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$8)
          Obtain the Scala “object” 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

getClassFor

public <T> scala.util.Try<java.lang.Class<? extends T>> getClassFor(java.lang.String fqcn,
                                                                    scala.reflect.ClassTag<T> evidence$5)
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

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$6)
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$7)
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

getObjectFor

public <T> scala.util.Try<T> getObjectFor(java.lang.String fqcn,
                                          scala.reflect.ClassTag<T> evidence$8)
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 class DynamicAccess