1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package net.sf.asterisk.manager;
18
19 import java.io.Serializable;
20 import java.util.HashMap;
21 import java.util.Map;
22
23 /***
24 * Enumeration that represents the state of a channel.
25 *
26 * @author srt
27 * @version $Id: ChannelStateEnum.java,v 1.3 2005/03/13 11:26:48 srt Exp $
28 */
29 public class ChannelStateEnum implements Serializable
30 {
31 /***
32 * Serializable version identifier
33 */
34 private static final long serialVersionUID = 6436381500165485011L;
35
36 private static Map literals = new HashMap();
37
38 private String state;
39
40 public static final ChannelStateEnum DOWN = new ChannelStateEnum("Down");
41 public static final ChannelStateEnum OFF_HOOK = new ChannelStateEnum("OffHook");
42 public static final ChannelStateEnum DIALING = new ChannelStateEnum("Dialing");
43 public static final ChannelStateEnum RING = new ChannelStateEnum("Ring");
44 public static final ChannelStateEnum RINGING = new ChannelStateEnum("Ringing");
45 public static final ChannelStateEnum UP = new ChannelStateEnum("Up");
46 public static final ChannelStateEnum BUSY = new ChannelStateEnum("Busy");
47 public static final ChannelStateEnum RSRVD = new ChannelStateEnum("Rsrvd");
48 public static final ChannelStateEnum HUNGUP = new ChannelStateEnum("Hungup");
49
50 private ChannelStateEnum(String state)
51 {
52 this.state = state;
53 literals.put(state, this);
54 }
55
56 public static ChannelStateEnum getEnum(String state)
57 {
58 return (ChannelStateEnum) literals.get(state);
59 }
60
61 public String toString()
62 {
63 return state;
64 }
65 }