File tree Expand file tree Collapse file tree
src/com/namelessmc/NamelessAPI Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11package com .namelessmc .NamelessAPI ;
22
33public class Notification {
4-
5- private String message ;
6- private String url ;
7- private NotificationType type ;
8-
9- public Notification (String message , String url , NotificationType type ) {
4+
5+ private final String message ;
6+ private final String url ;
7+ private final NotificationType type ;
8+
9+ public Notification (final String message , final String url , final NotificationType type ) {
1010 this .message = message ;
1111 this .url = url ;
1212 this .type = type ;
1313 }
14-
14+
1515 public String getMessage () {
16- return message ;
16+ return this . message ;
1717 }
18-
18+
1919 public String getUrl () {
20- return url ;
20+ return this . url ;
2121 }
22-
22+
2323 public NotificationType getType () {
24- return type ;
24+ return this . type ;
2525 }
26-
26+
2727 public static enum NotificationType {
2828
2929 TAG ,
@@ -32,12 +32,18 @@ public static enum NotificationType {
3232 PROFILE_COMMENT ,
3333 COMMENT_REPLY ,
3434 THREAD_REPLY ,
35- FOLLOW ;
36-
37- public static NotificationType fromString (String string ) {
38- return NotificationType .valueOf (string .replace ('-' , '_' ).toUpperCase ());
35+ FOLLOW ,
36+
37+ UNKNOWN ;
38+
39+ public static NotificationType fromString (final String string ) {
40+ try {
41+ return NotificationType .valueOf (string .replace ('-' , '_' ).toUpperCase ());
42+ } catch (final IllegalArgumentException e ) {
43+ return NotificationType .UNKNOWN ;
44+ }
3945 }
40-
46+
4147 }
4248
4349}
You can’t perform that action at this time.
0 commit comments