|
Package com. school. stereotype;
/**
* Activity Enumeration type
* @ Author QiXuan. Chen
*/
Public enum EventStatus {
/**
* Not released.
*/
DRAFT ("DRAFT", "unpublished "),
/**
* Released.
*/
PUBLISHED ("PUBLISHED", "PUBLISHED ");
/**
* Activity status value.
*/
Private String value;
/**
* Chinese description of activity status.
*/
Private String text;
/**
* @ Param status value of the activity status
* @ Param desc Chinese description of the activity status
*/
Private EventStatus (String status, String desc ){
Value = status;
Text = desc;
}
/**
* @ Return the value of the current enumerated object.
*/
Public String getValue (){
Return value;
}
/**
* @ Return Chinese description of the current status.
*/
Public String getText (){
Return text;
}
/**
* Obtains enumeration Objects Based on Activity Status values.
*
* @ Param status value of the activity status
* @ Return enumeration object
*/
Public static EventStatus getInstance (String status ){
EventStatus [] allStatus = EventStatus. values ();
For (EventStatus ws: allStatus ){
If (ws. getValue (). inclusignorecase (status )){
Return ws;
}
}
Throw new IllegalArgumentException ("the status value is invalid and there are no enumerated objects in the course status ");
}
}
|