/** * Returns the typed actor with given path, proxied with given interface. * * @param context Akka context. * @param path Relative path to actor. * @param interfaceClass Type of the proxy interface. * @param <T> Type of the proxy interface. * @return Typed actor. */ @Nonnull public static <T> T actorFor( @Nonnull final ActorContext context, @Nonnull final String path, @Nonnull final Class<T> interfaceClass) { assert context != null; assert path != null; assert interfaceClass != null; @Nonnull final ActorRef actorRef = context.actorFor(path); return TypedActor.get(context).typedActorOf(new TypedProps<>(interfaceClass), actorRef); }
/** * Returns the typed actor with given path, proxied with given interface. * * @param <T> Type of the proxy interface. * @param name Relative path to actor. * @param interfaceClass Type of the proxy interface. * @return Typed actor. */ @Nonnull public <T> T actorFor( @Nonnull final String name, @Nonnull final Class<T> interfaceClass) { assert name != null; assert interfaceClass != null; final ActorRef actorRef = context.actorFor(context.self().path().child(name)); //noinspection unchecked return (T) TypedActor.get(context).typedActorOf(new TypedProps(interfaceClass), actorRef); }
/** * Returns the typed actor with given path, proxied with given interface. * * @param name Relative path to actor. * @param interfaceClass Type of the proxy interface. * @param <T> Type of the proxy interface. * @return Typed actor. */ @Nonnull public static <T> T actorFor( @Nonnull final String name, @Nonnull final Class<T> interfaceClass) { assert name != null; assert interfaceClass != null; final ActorContext context = TypedActor.context(); final ActorRef actorRef = context.actorFor(context.self().path().child(name)); return TypedActor.get(context).typedActorOf(new TypedProps<>(interfaceClass), actorRef); }