View Javadoc

1   /*
2    * Copyright  2004-2005 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 net.sf.asterisk.manager;
18  
19  import java.io.Serializable;
20  import java.util.Date;
21  
22  /***
23   * Represents an Asterisk dialplan entry.
24   * 
25   * @author srt
26   * @version $Id: Extension.java,v 1.5 2005/08/08 06:10:18 srt Exp $
27   */
28  public class Extension implements Serializable
29  {
30      /***
31       * Serial version identifier.
32       */
33      private static final long serialVersionUID = 768239042942945744L;
34      private final Date date;
35      private final String context;
36      private final String extension;
37      private final Integer priority;
38      private final String application;
39      private final String appData;
40  
41      /***
42       * @param date
43       * @param context
44       * @param extension
45       * @param priority
46       */
47      public Extension(Date date, String context, String extension,
48              Integer priority)
49      {
50          this(date, context, extension, priority, null, null);
51      }
52  
53      /***
54       * @param date
55       * @param context
56       * @param extension
57       * @param priority
58       * @param application
59       * @param appData
60       */
61      public Extension(Date date, String context, String extension,
62              Integer priority, String application, String appData)
63      {
64          this.date = date;
65          this.context = context;
66          this.extension = extension;
67          this.priority = priority;
68          this.application = application;
69          this.appData = appData;
70      }
71  
72      public Date getDate()
73      {
74          return date;
75      }
76  
77      public String getContext()
78      {
79          return context;
80      }
81  
82      public String getExtension()
83      {
84          return extension;
85      }
86  
87      public Integer getPriority()
88      {
89          return priority;
90      }
91  
92      public String getApplication()
93      {
94          return application;
95      }
96  
97      public String getAppData()
98      {
99          return appData;
100     }
101 
102     public String toString()
103     {
104         StringBuffer sb;
105 
106         sb = new StringBuffer(getClass().getName() + ": ");
107         sb.append("date='" + getDate() + "'; ");
108         sb.append("context='" + getContext() + "'; ");
109         sb.append("extension='" + getExtension() + "'; ");
110         sb.append("priority='" + getPriority() + "'; ");
111         sb.append("application='" + getApplication() + "'; ");
112         sb.append("appData=" + getAppData() + "; ");
113         sb.append("systemHashcode=" + System.identityHashCode(this));
114 
115         return sb.toString();
116     }
117 }