forked from Qortal/qortal
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) {
|
||||
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
|
||||
|
Loading…
Reference in New Issue
Block a user