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 extension history of an {@link AsteriskChannel}.
24   *
25   * @author srt
26   * @version $Id$
27   * @since 0.3
28   */
29  public class ExtensionHistoryEntry implements Serializable
30  {
31      /**
32       * Serial version identifier.
33       */
34      private static final long serialVersionUID = 5437551192335452460L;
35      private final Date date;
36      private final Extension extension;
37  
38      /**
39       * Creates a new instance.
40       *
41       * @param date      the date the extension has been visited.
42       * @param extension the extension that has been visited.
43       */
44      public ExtensionHistoryEntry(Date date, Extension extension)
45      {
46          this.date = date;
47          this.extension = extension;
48      }
49  
50      /**
51       * Returns the date the extension has been visited.
52       *
53       * @return the date the extension has been visited.
54       */
55      public Date getDate()
56      {
57          return date;
58      }
59  
60      /**
61       * Returns the extension that has been visited.
62       *
63       * @return the extension that has been visited.
64       */
65      public Extension getExtension()
66      {
67          return extension;
68      }
69  
70      @Override
71      public String toString()
72      {
73          final StringBuilder sb;
74  
75          sb = new StringBuilder(100);
76          sb.append("ExtensionHistoryEntry[");
77          sb.append("date=").append(date).append(",");
78          sb.append("extension=").append(extension).append("]");
79          return sb.toString();
80      }
81  }