001/* 002 * Licensed to the Apache Software Foundation (ASF) under one 003 * or more contributor license agreements. See the NOTICE file 004 * distributed with this work for additional information 005 * regarding copyright ownership. The ASF licenses this file 006 * to you under the Apache License, Version 2.0 (the 007 * "License"); you may not use this file except in compliance 008 * with the License. You may obtain a copy of the License at 009 * 010 * http://www.apache.org/licenses/LICENSE-2.0 011 * 012 * Unless required by applicable law or agreed to in writing, 013 * software distributed under the License is distributed on an 014 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 015 * KIND, either express or implied. See the License for the 016 * specific language governing permissions and limitations 017 * under the License. 018 * 019 */ 020package org.apache.directory.shared.kerberos.codec.types; 021 022 023/** 024 * The list of possible value for the TransitedEncoding type 025 * 026 * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a> 027 */ 028public enum TransitedEncodingType 029{ 030 /** Constant for the "null" transited encoding type. */ 031 NULL(0), 032 033 /** Constant for the "Domain X500 compress" transited encoding type. */ 034 DOMAIN_X500_COMPRESS(1); 035 036 /** 037 * The value/code for the transited encoding type. 038 */ 039 private final int value; 040 041 042 /** 043 * Private constructor prevents construction outside of this class. 044 */ 045 private TransitedEncodingType( int value ) 046 { 047 this.value = value; 048 } 049 050 051 /** 052 * Returns the transited encoding type when specified by its value. 053 * 054 * @param type The type we are looking for 055 * @return The transited encoding type. 056 */ 057 public static TransitedEncodingType getTypeByOrdinal( int type ) 058 { 059 if ( type == 1 ) 060 { 061 return DOMAIN_X500_COMPRESS; 062 } 063 else 064 { 065 return NULL; 066 } 067 } 068 069 070 /** 071 * Returns the number associated with this transited encoding type. 072 * 073 * @return The transited encoding type value. 074 */ 075 public int getValue() 076 { 077 return value; 078 } 079 080 081 /** 082 * @see Object#toString() 083 */ 084 @Override 085 public String toString() 086 { 087 if ( this == DOMAIN_X500_COMPRESS ) 088 { 089 return "Domain X500 compress (1)"; 090 } 091 else 092 { 093 return "null (0)"; 094 } 095 } 096}