1 /*
2 * Licensed to the Apache Software Foundation (ASF) under one
3 * or more contributor license agreements. See the NOTICE file
4 * distributed with this work for additional information
5 * regarding copyright ownership. The ASF licenses this file
6 * to you under the Apache License, Version 2.0 (the
7 * "License"); you may not use this file except in compliance
8 * with the License. You may obtain a copy of the License at
9 *
10 * http://www.apache.org/licenses/LICENSE-2.0
11 *
12 * Unless required by applicable law or agreed to in writing,
13 * software distributed under the License is distributed on an
14 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15 * KIND, either express or implied. See the License for the
16 * specific language governing permissions and limitations
17 * under the License.
18 *
19 */
20
21 package org.apache.directory.server.dns.messages;
22
23
24 import org.apache.directory.server.dns.util.EnumConverter;
25 import org.apache.directory.server.dns.util.ReverseEnumMap;
26
27
28 /**
29 * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
30 * @version $Rev: 613608 $, $Date: 2008-01-20 17:59:10 +0100 (So, 20 Jan 2008) $
31 */
32 public enum RecordClass implements EnumConverter<Short>
33 {
34 /** Internet */
35 IN(1),
36
37 /** CSNET class */
38 CS(2),
39
40 /** CHAOS class */
41 CH(3),
42
43 /** Hesiod [Dyer 87] */
44 HS(4),
45
46 /** Special value used in dynamic update messages */
47 NONE(254),
48
49 /** Any class */
50 ANY(255);
51
52 private static ReverseEnumMap<Short, RecordClass> map = new ReverseEnumMap<Short, RecordClass>( RecordClass.class );
53
54 private final short value;
55
56
57 private RecordClass( int value )
58 {
59 this.value = ( short ) value;
60 }
61
62
63 public Short convert()
64 {
65 return this.value;
66 }
67
68
69 /**
70 * Converts an ordinal value into a {@link RecordClass}.
71 *
72 * @param value
73 * @return The {@link RecordClass}.
74 */
75 public static RecordClass convert( short value )
76 {
77 return map.get( value );
78 }
79 }