001package com.box.sdk; 002 003import com.eclipsesource.json.JsonObject; 004import com.eclipsesource.json.JsonValue; 005 006/** Represents the classification information for a File or Folder on Box. */ 007public class BoxClassification extends BoxJSONObject { 008 private String color; 009 private String definition; 010 private String name; 011 012 /** 013 * Constructs an BoxClassification object using an already parsed JSON object. 014 * 015 * @param jsonObject the parsed JSON object. 016 */ 017 BoxClassification(JsonObject jsonObject) { 018 super(jsonObject); 019 } 020 021 /** 022 * Gets the color that is used to display the classification label in a user-interface. 023 * 024 * @return the color of this classification. 025 */ 026 public String getColor() { 027 return this.color; 028 } 029 030 /** 031 * Gets the meaning of this classification. 032 * 033 * @return the meaning of this classification. 034 */ 035 public String getDefinition() { 036 return this.definition; 037 } 038 039 /** 040 * Gets the name of this classification. 041 * 042 * @return the name of this classification. 043 */ 044 public String getName() { 045 return this.name; 046 } 047 048 @Override 049 protected void parseJSONMember(JsonObject.Member member) { 050 super.parseJSONMember(member); 051 052 String memberName = member.getName(); 053 JsonValue value = member.getValue(); 054 055 try { 056 if (memberName.equals("color")) { 057 this.color = value.asString(); 058 } else if (memberName.equals("definition")) { 059 this.definition = value.asString(); 060 } else if (memberName.equals("name")) { 061 this.name = value.asString(); 062 } 063 } catch (Exception e) { 064 throw new BoxDeserializationException(memberName, value.toString(), e); 065 } 066 } 067}