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