GreenThor GreenThor - 1 month ago 11
Java Question

What is the difference between Terminated#actor() and Terminated#getActor()

I simply want to know the actor of the

Terminated
message another actor received, to be sure to handle the message only if the "right" actor was terminated. The
Terminated
class has two methods to tell me that, what is the difference between them? I can't read Scala yet, so looking up the source hasn't helped me. The methods are not documented with JavaDoc.

Terminated terminated = (Terminated)message;
terminated.actor(); // what is this?
terminated.getActor(); // what is that?


Help is appreciated :-)

Answer

There is no difference. actor is simply the Scala property, whereas getActor is the corresponding Java accessor.

You can see it in the signature of the class:

final case class Terminated private[akka] (@BeanProperty actor: ActorRef)

The @BeanProperty annotation is a special Scala one that generates accessors and mutators (getX/setX) for Java bean compatibility.