Merge "BUG-46: preliminary switch to MD-SAL"
[bgpcep.git] / concepts / src / main / java / org / opendaylight / protocol / concepts / Stateful.java
1 /*
2  * Copyright (c) 2013 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.protocol.concepts;
9
10 /**
11  * Interface marking object which hold some state, which can be captured and saved. Capturing this state is useful for
12  * various entities which need to see a consistent, point-in-time view of the state.
13  * 
14  * @param <T> Type reference of the returned state object
15  */
16 public interface Stateful<T extends State> {
17         /**
18          * Return a reference to the current state of the object. The returned object must remain immutable throughout its
19          * lifetime. Furthermore using equals() on two state objects returned from this method must return true if and only
20          * if the internal state of this object the the two points was equivalent.
21          * 
22          * @return Reference to a point-in-time consistent state of the object.
23          */
24         public T currentState();
25 }