Formatting java codes with sbt-java-formatter.
This commit is contained in:
parent
27500001ea
commit
998c5a9285
401 changed files with 19750 additions and 17450 deletions
|
|
@ -4,32 +4,43 @@
|
|||
|
||||
package jdocs.actor;
|
||||
|
||||
//#sample-actor
|
||||
// #sample-actor
|
||||
import akka.actor.AbstractActor;
|
||||
|
||||
public class SampleActor extends AbstractActor {
|
||||
|
||||
private Receive guarded = receiveBuilder()
|
||||
.match(String.class, s -> s.contains("guard"), s -> {
|
||||
getSender().tell("contains(guard): " + s, getSelf());
|
||||
getContext().unbecome();
|
||||
})
|
||||
.build();
|
||||
private Receive guarded =
|
||||
receiveBuilder()
|
||||
.match(
|
||||
String.class,
|
||||
s -> s.contains("guard"),
|
||||
s -> {
|
||||
getSender().tell("contains(guard): " + s, getSelf());
|
||||
getContext().unbecome();
|
||||
})
|
||||
.build();
|
||||
|
||||
@Override
|
||||
public Receive createReceive() {
|
||||
return receiveBuilder()
|
||||
.match(Double.class, d -> {
|
||||
getSender().tell(d.isNaN() ? 0 : d, getSelf());
|
||||
})
|
||||
.match(Integer.class, i -> {
|
||||
getSender().tell(i * 10, getSelf());
|
||||
})
|
||||
.match(String.class, s -> s.startsWith("guard"), s -> {
|
||||
getSender().tell("startsWith(guard): " + s.toUpperCase(), getSelf());
|
||||
getContext().become(guarded, false);
|
||||
})
|
||||
.build();
|
||||
.match(
|
||||
Double.class,
|
||||
d -> {
|
||||
getSender().tell(d.isNaN() ? 0 : d, getSelf());
|
||||
})
|
||||
.match(
|
||||
Integer.class,
|
||||
i -> {
|
||||
getSender().tell(i * 10, getSelf());
|
||||
})
|
||||
.match(
|
||||
String.class,
|
||||
s -> s.startsWith("guard"),
|
||||
s -> {
|
||||
getSender().tell("startsWith(guard): " + s.toUpperCase(), getSelf());
|
||||
getContext().become(guarded, false);
|
||||
})
|
||||
.build();
|
||||
}
|
||||
}
|
||||
//#sample-actor
|
||||
// #sample-actor
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue