//
// Created by Grishul Eugeny
//
// Copyright © Grishul Eugeny 2008
//

public enum EnterpriseRole {

Chief( 0 ),
Scientist( 1 ),
Tester( 2 ),
SecurityMan( 3 ),
TechnicalSupport( 4 );

private int _value;

EnterpriseRole( int value ) {
_value = value;
}

public int getValue() {
return _value;
}

public static EnterpriseRole fromValue( int value ) throws Throwable {
for( EnterpriseRole currentValue : EnterpriseRole.values() )
if( currentValue._value == value )
return currentValue;

throw new Exception( "value" );
}

public static EnterpriseRole parse( String name ) throws Throwable {
for( EnterpriseRole currentValue : EnterpriseRole.values() )
if( currentValue.name().equals( name ) )
return currentValue;

throw new Exception( name );
}

public static EnterpriseRole parse( String name, boolean ignoreCase ) throws Throwable {
if( !ignoreCase )
return parse( name );

for( EnterpriseRole currentValue : EnterpriseRole.values() )
if( currentValue.name().equalsIgnoreCase( name ) )
return currentValue;

throw new Exception( name );
}
}
Соседние файлы в папке src