View Javadoc

1   /*
2    *  Copyright 2004-2006 Stefan Reuter
3    *
4    *  Licensed under the Apache License, Version 2.0 (the "License");
5    *  you may not use this file except in compliance with the License.
6    *  You may obtain a copy of the License at
7    *
8    *      http://www.apache.org/licenses/LICENSE-2.0
9    *
10   *  Unless required by applicable law or agreed to in writing, software
11   *  distributed under the License is distributed on an "AS IS" BASIS,
12   *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   *  See the License for the specific language governing permissions and
14   *  limitations under the License.
15   *
16   */
17  package org.asteriskjava.live;
18  
19  import java.io.Serializable;
20  import java.util.Date;
21  
22  /**
23   * An entry in the channel state history of an {@link AsteriskChannel}.
24   *
25   * @author srt
26   * @version $Id$
27   * @since 0.3
28   */
29  public class ChannelStateHistoryEntry implements Serializable
30  {
31      /**
32       * Serial version identifier.
33       */
34      private static final long serialVersionUID = 5437551192335452460L;
35      private final Date date;
36      private final ChannelState state;
37  
38      /**
39       * Creates a new instance.
40       *
41       * @param date  the date the channel entered the state.
42       * @param state the state the channel entered.
43       */
44      public ChannelStateHistoryEntry(Date date, ChannelState state)
45      {
46          this.date = date;
47          this.state = state;
48      }
49  
50      /**
51       * Returns the date the channel entered the state.
52       *
53       * @return the date the channel entered the state.
54       */
55      public Date getDate()
56      {
57          return date;
58      }
59  
60      /**
61       * The state the channel entered.
62       *
63       * @return the state the channel entered.
64       */
65      public ChannelState getState()
66      {
67          return state;
68      }
69  
70      @Override
71      public String toString()
72      {
73          final StringBuilder sb;
74  
75          sb = new StringBuilder("ChannelStateHistoryEntry[");
76          sb.append("date=").append(date).append(",");
77          sb.append("state=").append(state).append("]");
78          return sb.toString();
79      }
80  }