mirror of
https://github.com/gyurix1968/guacamole-client.git
synced 2025-09-06 05:07:41 +00:00
GUACAMOLE-44: Provide for direct translation of status codes into GuacamoleStatus values.
This commit is contained in:
@@ -167,4 +167,30 @@ public enum GuacamoleStatus {
|
|||||||
return guac_code;
|
return guac_code;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the GuacamoleStatus corresponding to the given Guacamole
|
||||||
|
* protocol status code. If no such GuacamoleStatus is defined, null is
|
||||||
|
* returned.
|
||||||
|
*
|
||||||
|
* @param code
|
||||||
|
* The Guacamole protocol status code to translate into a
|
||||||
|
* GuacamoleStatus.
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
* The GuacamoleStatus corresponding to the given Guacamole protocol
|
||||||
|
* status code, or null if no such GuacamoleStatus is defined.
|
||||||
|
*/
|
||||||
|
public static GuacamoleStatus fromGuacamoleStatusCode(int code) {
|
||||||
|
|
||||||
|
// Search for a GuacamoleStatus having the given status code
|
||||||
|
for (GuacamoleStatus status : values()) {
|
||||||
|
if (status.getGuacamoleStatusCode() == code)
|
||||||
|
return status;
|
||||||
|
}
|
||||||
|
|
||||||
|
// No such status found
|
||||||
|
return null;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user