=all #3858 Make case classes final

This commit is contained in:
dario.rexin 2014-03-07 13:20:01 +01:00
parent dfef14a590
commit 2cbad298d6
189 changed files with 766 additions and 767 deletions

View file

@ -31,8 +31,8 @@ class MyActor extends Actor {
}
//#my-actor
case class DoIt(msg: ImmutableMessage)
case class Message(s: String)
final case class DoIt(msg: ImmutableMessage)
final case class Message(s: String)
//#context-actorOf
class FirstActor extends Actor {
@ -216,7 +216,7 @@ class ProducerConsumer extends Actor with ActorLogging
// protocol
case object GiveMeThings
case class Give(thing: Any)
final case class Give(thing: Any)
//#receive-orElse
@ -524,7 +524,7 @@ class ActorDocSpec extends AkkaSpec(Map("akka.loglevel" -> "INFO")) {
//#ask-pipeTo
import akka.pattern.{ ask, pipe }
import system.dispatcher // The ExecutionContext that will be used
case class Result(x: Int, s: String, d: Double)
final case class Result(x: Int, s: String, d: Double)
case object Request
implicit val timeout = Timeout(5 seconds) // needed for `?` below

View file

@ -21,12 +21,12 @@ class FSMDocSpec extends MyFavoriteTestFrameWorkPlusAkkaTestKit {
//#simple-imports
//#simple-events
// received events
case class SetTarget(ref: ActorRef)
case class Queue(obj: Any)
final case class SetTarget(ref: ActorRef)
final case class Queue(obj: Any)
case object Flush
// sent events
case class Batch(obj: immutable.Seq[Any])
final case class Batch(obj: immutable.Seq[Any])
//#simple-events
//#simple-state
// states
@ -36,7 +36,7 @@ class FSMDocSpec extends MyFavoriteTestFrameWorkPlusAkkaTestKit {
sealed trait Data
case object Uninitialized extends Data
case class Todo(target: ActorRef, queue: immutable.Seq[Any]) extends Data
final case class Todo(target: ActorRef, queue: immutable.Seq[Any]) extends Data
//#simple-state
//#simple-fsm
class Buncher extends Actor with FSM[State, Data] {

View file

@ -67,7 +67,7 @@ class Listener extends Actor with ActorLogging {
object Worker {
case object Start
case object Do
case class Progress(percent: Double)
final case class Progress(percent: Double)
}
//#messages
@ -112,9 +112,9 @@ class Worker extends Actor with ActorLogging {
//#messages
object CounterService {
case class Increment(n: Int)
final case class Increment(n: Int)
case object GetCurrentCount
case class CurrentCount(key: String, count: Long)
final case class CurrentCount(key: String, count: Long)
class ServiceUnavailable(msg: String) extends RuntimeException(msg)
private case object Reconnect
@ -212,7 +212,7 @@ class CounterService extends Actor {
//#messages
object Counter {
case class UseStorage(storage: Option[ActorRef])
final case class UseStorage(storage: Option[ActorRef])
}
//#messages
@ -253,9 +253,9 @@ class Counter(key: String, initialValue: Long) extends Actor {
//#messages
object Storage {
case class Store(entry: Entry)
case class Get(key: String)
case class Entry(key: String, value: Long)
final case class Store(entry: Entry)
final case class Get(key: String)
final case class Entry(key: String, value: Long)
class StorageException(msg: String) extends RuntimeException(msg)
}
//#messages

View file

@ -14,7 +14,7 @@ object EventBusDocSpec {
import akka.event.EventBus
import akka.event.LookupClassification
case class MsgEnvelope(topic: String, payload: Any)
final case class MsgEnvelope(topic: String, payload: Any)
/**
* Publishes the payload of the MsgEnvelope when the topic of the
@ -124,7 +124,7 @@ object EventBusDocSpec {
import akka.event.ActorClassification
import akka.event.ActorClassifier
case class Notification(ref: ActorRef, id: Int)
final case class Notification(ref: ActorRef, id: Int)
class ActorBusImpl extends ActorEventBus with ActorClassifier with ActorClassification {
type Event = Notification

View file

@ -51,7 +51,7 @@ object LoggingDocSpec {
//#mdc-actor
import Logging.MDC
case class Req(work: String, visitorId: Int)
final case class Req(work: String, visitorId: Int)
class MdcActorMixin extends Actor with akka.actor.DiagnosticActorLogging {
var reqId = 0

View file

@ -81,7 +81,7 @@ class EchoHandler(connection: ActorRef, remote: InetSocketAddress)
import Tcp._
case class Ack(offset: Int) extends Event
final case class Ack(offset: Int) extends Event
// sign death pact: this actor terminates when connection breaks
context watch connection

View file

@ -24,13 +24,13 @@ object ConsistentHashingRouterDocSpec {
}
}
case class Evict(key: String)
final case class Evict(key: String)
case class Get(key: String) extends ConsistentHashable {
final case class Get(key: String) extends ConsistentHashable {
override def consistentHashKey: Any = key
}
case class Entry(key: String, value: String)
final case class Entry(key: String, value: String)
//#cache-actor
}

View file

@ -63,7 +63,7 @@ akka.actor.deployment {
}
//#unit-test-logic
case class TestRoutee(n: Int) extends Routee {
final case class TestRoutee(n: Int) extends Routee {
override def send(message: Any, sender: ActorRef): Unit = ()
}
@ -77,7 +77,7 @@ import akka.routing.Router
import akka.japi.Util.immutableSeq
import com.typesafe.config.Config
case class RedundancyGroup(override val paths: immutable.Iterable[String], nbrCopies: Int) extends Group {
final case class RedundancyGroup(override val paths: immutable.Iterable[String], nbrCopies: Int) extends Group {
def this(config: Config) = this(
paths = immutableSeq(config.getStringList("routees.paths")),

View file

@ -200,7 +200,7 @@ akka.actor.deployment {
router-dispatcher {}
"""
case class Work(payload: String)
final case class Work(payload: String)
//#router-in-actor
import akka.routing.ActorRefRoutee

View file

@ -49,7 +49,7 @@ package docs.serialization {
//#my-own-serializer
trait MyOwnSerializable
case class Customer(name: String) extends MyOwnSerializable
final case class Customer(name: String) extends MyOwnSerializable
class SerializationDocSpec extends AkkaSpec {
"demonstrate configuration of serialize messages" in {

View file

@ -194,7 +194,7 @@ class TestkitDocSpec extends AkkaSpec with DefaultTimeout with ImplicitSender {
//#test-probe
//#test-special-probe
case class Update(id: Int, value: String)
final case class Update(id: Int, value: String)
val probe = new TestProbe(system) {
def expectUpdate(x: Int) = {

View file

@ -24,8 +24,8 @@ object ZeromqDocSpec {
import java.lang.management.ManagementFactory
case object Tick
case class Heap(timestamp: Long, used: Long, max: Long)
case class Load(timestamp: Long, loadAverage: Double)
final case class Heap(timestamp: Long, used: Long, max: Long)
final case class Load(timestamp: Long, loadAverage: Double)
class HealthProbe extends Actor {