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

public enum TaskType {

VirusCreation( 0 ),
TechsupportRequest( 1 ),
SecurityRequest( 2 );
private int _value;

TaskType( int value ) {
_value = value;
}

public int getValue() {
return _value;
}

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

throw new Exception( "value" );
}

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

throw new Exception( name );
}

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

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

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