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     * @param  jsonObject the parsed JSON object.
017     */
018    BoxClassification(JsonObject jsonObject) {
019        super(jsonObject);
020    }
021
022    /**
023     * Gets the color that is used to display the classification label in a user-interface.
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     * @return the meaning of this classification.
033     */
034    public String getDefinition() {
035        return this.definition;
036    }
037
038    /**
039     * Gets the name of this classification.
040     * @return the name of this classification.
041     */
042    public String getName() {
043        return this.name;
044    }
045
046    @Override
047    protected void parseJSONMember(JsonObject.Member member) {
048        super.parseJSONMember(member);
049
050        String memberName = member.getName();
051        JsonValue value = member.getValue();
052
053        try {
054            if (memberName.equals("color")) {
055                this.color = value.asString();
056            } else if (memberName.equals("definition")) {
057                this.definition = value.asString();
058            } else if (memberName.equals("name")) {
059                this.name = value.asString();
060            }
061        } catch (Exception e) {
062            throw new BoxDeserializationException(memberName, value.toString(), e);
063        }
064    }
065}