0ca3545cf33eba797b6b278a5da675d75e4d442e
[controller.git] / opendaylight / md-sal / cds-access-client / src / main / java / org / opendaylight / controller / cluster / access / client / AbstractClientActorContext.java
1 /*
2  * Copyright (c) 2016 Cisco Systems, Inc. and others.  All rights reserved.
3  *
4  * This program and the accompanying materials are made available under the
5  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6  * and is available at http://www.eclipse.org/legal/epl-v10.html
7  */
8 package org.opendaylight.controller.cluster.access.client;
9
10 import akka.actor.ActorRef;
11 import com.google.common.base.Preconditions;
12 import javax.annotation.Nonnull;
13 import org.opendaylight.yangtools.concepts.Mutable;
14
15 /**
16  * Common, externally-invisible superclass of contexts associated with a {@link AbstractClientActor}. End users pass this
17  * object via opaque {@link ClientActorContext}.
18  *
19  * @author Robert Varga
20  */
21 abstract class AbstractClientActorContext implements Mutable {
22     private final String persistenceId;
23     private final ActorRef self;
24
25     AbstractClientActorContext(final @Nonnull ActorRef self, final @Nonnull String persistenceId) {
26         this.persistenceId = Preconditions.checkNotNull(persistenceId);
27         this.self = Preconditions.checkNotNull(self);
28     }
29
30     final @Nonnull String persistenceId() {
31         return persistenceId;
32     }
33
34     public final @Nonnull ActorRef self() {
35         return self;
36     }
37 }