1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28 package de.nierbeck.timeTrack.views;
29
30 /***
31 * @author Achim
32 *
33 */
34 public class ColumnEnum {
35
36 private int ord;
37
38 private String name;
39
40 private String retrievalMethodName;
41
42 /***
43 * Creates a new Enumeration (Boch Style)
44 *
45 * @param name - the name value of the Enum Instance
46 * @param ord - the ordinal value of the Enum Instance
47 * @param methodName - the Method name to retrieve a given value
48 */
49 public ColumnEnum(String name, int ord, String methodName) {
50 this.name = name;
51 this.ord = ord;
52 retrievalMethodName = methodName;
53 }
54
55 /***
56 * Ordinal for Start Date
57 */
58 public static final int START_DATE_ORD = 0;
59
60 /***
61 * Ordinal for Duration
62 */
63 public static final int DURATION_ORD = 1;
64
65 /***
66 * Ordinal for Project
67 */
68 public static final int PROJECT_ORD = 2;
69
70 /***
71 * Ordinal for Task
72 */
73 public static final int TASK_ORD = 3;
74
75 /***
76 * Ordinal for Comment
77 */
78 public static final int COMMENT_ORD = 4;
79
80 /***
81 * Enum for Start Date
82 */
83 public static final ColumnEnum START_DATE = new ColumnEnum(Messages
84 .getString("ColumnEnum.startDate"), START_DATE_ORD, "getStartTime");
85
86 /***
87 * Enum for Duration
88 */
89 public static final ColumnEnum DURATION = new ColumnEnum(Messages
90 .getString("ColumnEnum.duration"), DURATION_ORD, "getDuration");
91
92 /***
93 * Enum for Project
94 */
95 public static final ColumnEnum PROJECT = new ColumnEnum(Messages
96 .getString("ColumnEnum.project"), PROJECT_ORD, "getProject");
97
98 /***
99 * Enum for Task
100 */
101 public static final ColumnEnum TASK = new ColumnEnum(Messages
102 .getString("ColumnEnum.task"), TASK_ORD, "getTask");
103
104 /***
105 * Enum for comment
106 */
107 public static final ColumnEnum COMMENT = new ColumnEnum(Messages
108 .getString("ColumnEnum.comment"), COMMENT_ORD, "getComment");
109
110 /***
111 * Finds the Enum according to the ordinal number
112 *
113 * @param ord - the number to search for
114 * @return the ColumnEnum that was searched for
115 */
116 public static ColumnEnum find(int ord) {
117 switch (ord) {
118 case START_DATE_ORD:
119 return START_DATE;
120 case DURATION_ORD:
121 return DURATION;
122 case PROJECT_ORD:
123 return PROJECT;
124 case TASK_ORD:
125 return TASK;
126 case COMMENT_ORD:
127 return COMMENT;
128 default:
129 return null;
130 }
131 }
132
133 /***
134 *
135 * @return the name of the Enumeration
136 */
137 public final String getName() {
138 return name;
139 }
140
141 /***
142 *
143 * @return the Ordinal number of the enum
144 */
145 public final int getOrd() {
146 return ord;
147 }
148
149 /***
150 * @return Returns the retrievalMethodName.
151 */
152 public final String getRetrievalMethodName() {
153 return retrievalMethodName;
154 }
155 }