mirror of
https://github.com/Qortal/qortal.git
synced 2025-04-16 16:15:53 +00:00
Allow exception-free conversion from String to PresenceType
This commit is contained in:
parent
4e89b8fbac
commit
7cbdbbcc8d
@ -69,6 +69,15 @@ public class PresenceTransaction extends Transaction {
|
|||||||
public static PresenceType valueOf(int value) {
|
public static PresenceType valueOf(int value) {
|
||||||
return map.get(value);
|
return map.get(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Returns PresenceType with matching <tt>name</tt> or <tt>null</tt> (instead of throwing IllegalArgumentException). */
|
||||||
|
public static PresenceType fromString(String name) {
|
||||||
|
try {
|
||||||
|
return PresenceType.valueOf(name);
|
||||||
|
} catch (IllegalArgumentException e) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Constructors
|
// Constructors
|
||||||
|
Loading…
x
Reference in New Issue
Block a user