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 package org.apache.directory.server.kerberos.shared.messages.value.types;
21
22
23 /**
24 * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
25 * @version $Rev: 540371 $, $Date: 2007-05-22 02:00:43 +0200 (Tue, 22 May 2007) $
26 */
27 public enum TransitedEncodingType
28 {
29 /**
30 * Constant for the "null" transited encoding type.
31 */
32 NULL( 0 ),
33
34 /**
35 * Constant for the "Domain X500 compress" transited encoding type.
36 */
37 DOMAIN_X500_COMPRESS( 1 );
38
39
40 /**
41 * The value/code for the transited encoding type.
42 */
43 private final int ordinal;
44
45
46 /**
47 * Private constructor prevents construction outside of this class.
48 */
49 private TransitedEncodingType( int ordinal )
50 {
51 this.ordinal = ordinal;
52 }
53
54
55 /**
56 * Returns the transited encoding type when specified by its ordinal.
57 *
58 * @param type
59 * @return The transited encoding type.
60 */
61 public static TransitedEncodingType getTypeByOrdinal( int type )
62 {
63 switch ( type )
64 {
65 case 1 : return DOMAIN_X500_COMPRESS;
66 default : return NULL;
67 }
68 }
69
70
71 /**
72 * Returns the number associated with this transited encoding type.
73 *
74 * @return The transited encoding type ordinal.
75 */
76 public int getOrdinal()
77 {
78 return ordinal;
79 }
80
81 /**
82 * @see Object#toString()
83 */
84 public String toString()
85 {
86 switch ( this )
87 {
88 case DOMAIN_X500_COMPRESS : return "Domain X500 compress (1)";
89 default : return "null (0)";
90 }
91 }
92 }