@@ -233,59 +233,55 @@ protected void parseJSONMember(JsonObject.Member member) {
233233 String memberName = member .getName ();
234234 JsonValue value = member .getValue ();
235235 try {
236- switch (memberName ) {
237- case "created_by" :
238- JsonObject userJSON = value .asObject ();
239- if (this .createdBy == null ) {
240- String userID = userJSON .get ("id" ).asString ();
241- BoxUser user = new BoxUser (getAPI (), userID );
242- this .createdBy = user .new Info (userJSON );
243- } else {
244- this .createdBy .update (userJSON );
245- }
246- break ;
247- case "created_at" :
248- this .createdAt = BoxDateFormat .parse (value .asString ());
249- break ;
250- case "modified_at" :
251- this .modifiedAt = BoxDateFormat .parse (value .asString ());
252- break ;
253- case "expires_at" :
254- this .expiresAt = BoxDateFormat .parse (value .asString ());
255- break ;
256- case "status" :
257- String statusString = value .asString ().toUpperCase ();
258- this .status = Status .valueOf (statusString );
259- break ;
260- case "accessible_by" :
261- userJSON = value .asObject ();
262- if (this .accessibleBy == null ) {
263- String userID = userJSON .get ("id" ).asString ();
264- BoxUser user = new BoxUser (getAPI (), userID );
265- BoxUser .Info userInfo = user .new Info (userJSON );
266- this .accessibleBy = userInfo ;
267- } else {
268- this .accessibleBy .update (userJSON );
269- }
270- break ;
271- case "role" :
272- this .role = Role .fromJSONString (value .asString ());
273- break ;
274- case "acknowledged_at" :
275- this .acknowledgedAt = BoxDateFormat .parse (value .asString ());
276- break ;
277- case "item" :
278- JsonObject folderJSON = value .asObject ();
279- if (this .item == null ) {
280- String folderID = folderJSON .get ("id" ).asString ();
281- BoxFolder folder = new BoxFolder (getAPI (), folderID );
282- this .item = folder .new Info (folderJSON );
283- } else {
284- this .item .update (folderJSON );
285- }
286- break ;
287- default :
288- break ;
236+ if (memberName .equals ("created_by" )) {
237+ JsonObject userJSON = value .asObject ();
238+ if (this .createdBy == null ) {
239+ String userID = userJSON .get ("id" ).asString ();
240+ BoxUser user = new BoxUser (getAPI (), userID );
241+ this .createdBy = user .new Info (userJSON );
242+ } else {
243+ this .createdBy .update (userJSON );
244+ }
245+
246+ } else if (memberName .equals ("created_at" )) {
247+ this .createdAt = BoxDateFormat .parse (value .asString ());
248+
249+ } else if (memberName .equals ("modified_at" )) {
250+ this .modifiedAt = BoxDateFormat .parse (value .asString ());
251+
252+ } else if (memberName .equals ("expires_at" )) {
253+ this .expiresAt = BoxDateFormat .parse (value .asString ());
254+
255+ } else if (memberName .equals ("status" )) {
256+ String statusString = value .asString ().toUpperCase ();
257+ this .status = Status .valueOf (statusString );
258+
259+ } else if (memberName .equals ("accessible_by" )) {
260+ JsonObject userJSON = value .asObject ();
261+ if (this .accessibleBy == null ) {
262+ String userID = userJSON .get ("id" ).asString ();
263+ BoxUser user = new BoxUser (getAPI (), userID );
264+ BoxUser .Info userInfo = user .new Info (userJSON );
265+ this .accessibleBy = userInfo ;
266+ } else {
267+ this .accessibleBy .update (userJSON );
268+ }
269+
270+ } else if (memberName .equals ("role" )) {
271+ this .role = Role .fromJSONString (value .asString ());
272+
273+ } else if (memberName .equals ("acknowledged_at" )) {
274+ this .acknowledgedAt = BoxDateFormat .parse (value .asString ());
275+
276+ } else if (memberName .equals ("item" )) {
277+ JsonObject folderJSON = value .asObject ();
278+ if (this .item == null ) {
279+ String folderID = folderJSON .get ("id" ).asString ();
280+ BoxFolder folder = new BoxFolder (getAPI (), folderID );
281+ this .item = folder .new Info (folderJSON );
282+ } else {
283+ this .item .update (folderJSON );
284+ }
289285 }
290286 } catch (ParseException e ) {
291287 assert false : "A ParseException indicates a bug in the SDK." ;
@@ -384,25 +380,24 @@ private Role(String jsonValue) {
384380 }
385381
386382 static Role fromJSONString (String jsonValue ) {
387- switch (jsonValue ) {
388- case "editor" :
389- return EDITOR ;
390- case "viewer" :
391- return VIEWER ;
392- case "previewer" :
393- return PREVIEWER ;
394- case "uploader" :
395- return UPLOADER ;
396- case "previewer uploader" :
397- return PREVIEWER_UPLOADER ;
398- case "viewer uploader" :
399- return VIEWER_UPLOADER ;
400- case "co-owner" :
401- return CO_OWNER ;
402- case "owner" :
403- return OWNER ;
404- default :
405- throw new IllegalArgumentException ("The provided JSON value isn't a valid Role." );
383+ if (jsonValue .equals ("editor" )) {
384+ return EDITOR ;
385+ } else if (jsonValue .equals ("viewer" )) {
386+ return VIEWER ;
387+ } else if (jsonValue .equals ("previewer" )) {
388+ return PREVIEWER ;
389+ } else if (jsonValue .equals ("uploader" )) {
390+ return UPLOADER ;
391+ } else if (jsonValue .equals ("previewer uploader" )) {
392+ return PREVIEWER_UPLOADER ;
393+ } else if (jsonValue .equals ("viewer uploader" )) {
394+ return VIEWER_UPLOADER ;
395+ } else if (jsonValue .equals ("co-owner" )) {
396+ return CO_OWNER ;
397+ } else if (jsonValue .equals ("owner" )) {
398+ return OWNER ;
399+ } else {
400+ throw new IllegalArgumentException ("The provided JSON value isn't a valid Role." );
406401 }
407402 }
408403
0 commit comments