akka.actor
Class ExtensionKey<T extends Extension>

java.lang.Object
  extended by akka.actor.ExtensionKey<T>
All Implemented Interfaces:
ExtensionId<T>, ExtensionIdProvider

public abstract class ExtensionKey<T extends Extension>
extends java.lang.Object
implements ExtensionId<T>, ExtensionIdProvider

This is a one-stop-shop if all you want is an extension which is constructed with the ExtendedActorSystem as its only constructor argument:


 object MyExt extends ExtensionKey[Ext]

 class Ext(system: ExtendedActorSystem) extends Extension {
   ...
 }
 

Java API:


 public class MyExt extends Extension {
   public static final ExtensionKey<MyExt> key = new ExtensionKey<MyExt>(MyExt.class);

   public MyExt(ExtendedActorSystem system) {
     ...
   }
 }
 

Note: Don't use this class if the extension is written in Scala and consumed in Eclipse Java projects. JDT has problems resolving correct type for the get method.


Constructor Summary
ExtensionKey(java.lang.Class<T> clazz)
           
ExtensionKey(scala.reflect.ClassTag<T> m)
           
 
Method Summary
 T createExtension(ExtendedActorSystem system)
          Is used by Akka to instantiate the Extension identified by this ExtensionId, internal use only.
 ExtensionId<T> lookup()
          Returns the canonical ExtensionId for this Extension
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface akka.actor.ExtensionId
apply, equals, get, hashCode
 

Constructor Detail

ExtensionKey

public ExtensionKey(scala.reflect.ClassTag<T> m)

ExtensionKey

public ExtensionKey(java.lang.Class<T> clazz)
Method Detail

lookup

public ExtensionId<T> lookup()
Description copied from interface: ExtensionIdProvider
Returns the canonical ExtensionId for this Extension

Specified by:
lookup in interface ExtensionIdProvider

createExtension

public T createExtension(ExtendedActorSystem system)
Description copied from interface: ExtensionId
Is used by Akka to instantiate the Extension identified by this ExtensionId, internal use only.

Specified by:
createExtension in interface ExtensionId<T extends Extension>