001package com.box.sdkgen.schemas.appitem; 002 003import com.box.sdkgen.internal.NullableFieldTracker; 004import com.box.sdkgen.internal.SerializableObject; 005import com.box.sdkgen.serialization.json.EnumWrapper; 006import com.fasterxml.jackson.annotation.JsonFilter; 007import com.fasterxml.jackson.annotation.JsonProperty; 008import com.fasterxml.jackson.databind.annotation.JsonDeserialize; 009import com.fasterxml.jackson.databind.annotation.JsonSerialize; 010import java.util.Objects; 011 012/** 013 * An app item represents an content object owned by an application. It can group files and folders 014 * together from different paths. That set can be shared via a collaboration. 015 */ 016@JsonFilter("nullablePropertyFilter") 017public class AppItem extends SerializableObject { 018 019 /** The unique identifier for this app item. */ 020 protected final String id; 021 022 /** The value will always be `app_item`. */ 023 @JsonDeserialize(using = AppItemTypeField.AppItemTypeFieldDeserializer.class) 024 @JsonSerialize(using = AppItemTypeField.AppItemTypeFieldSerializer.class) 025 protected EnumWrapper<AppItemTypeField> type; 026 027 /** The type of the app that owns this app item. */ 028 @JsonProperty("application_type") 029 protected final String applicationType; 030 031 public AppItem( 032 @JsonProperty("id") String id, @JsonProperty("application_type") String applicationType) { 033 super(); 034 this.id = id; 035 this.applicationType = applicationType; 036 this.type = new EnumWrapper<AppItemTypeField>(AppItemTypeField.APP_ITEM); 037 } 038 039 protected AppItem(Builder builder) { 040 super(); 041 this.id = builder.id; 042 this.type = builder.type; 043 this.applicationType = builder.applicationType; 044 markNullableFieldsAsSet(builder.getExplicitlySetNullableFields()); 045 } 046 047 public String getId() { 048 return id; 049 } 050 051 public EnumWrapper<AppItemTypeField> getType() { 052 return type; 053 } 054 055 public String getApplicationType() { 056 return applicationType; 057 } 058 059 @Override 060 public boolean equals(Object o) { 061 if (this == o) { 062 return true; 063 } 064 if (o == null || getClass() != o.getClass()) { 065 return false; 066 } 067 AppItem casted = (AppItem) o; 068 return Objects.equals(id, casted.id) 069 && Objects.equals(type, casted.type) 070 && Objects.equals(applicationType, casted.applicationType); 071 } 072 073 @Override 074 public int hashCode() { 075 return Objects.hash(id, type, applicationType); 076 } 077 078 @Override 079 public String toString() { 080 return "AppItem{" 081 + "id='" 082 + id 083 + '\'' 084 + ", " 085 + "type='" 086 + type 087 + '\'' 088 + ", " 089 + "applicationType='" 090 + applicationType 091 + '\'' 092 + "}"; 093 } 094 095 public static class Builder extends NullableFieldTracker { 096 097 protected final String id; 098 099 protected EnumWrapper<AppItemTypeField> type; 100 101 protected final String applicationType; 102 103 public Builder(String id, String applicationType) { 104 super(); 105 this.id = id; 106 this.applicationType = applicationType; 107 } 108 109 public Builder type(AppItemTypeField type) { 110 this.type = new EnumWrapper<AppItemTypeField>(type); 111 return this; 112 } 113 114 public Builder type(EnumWrapper<AppItemTypeField> type) { 115 this.type = type; 116 return this; 117 } 118 119 public AppItem build() { 120 if (this.type == null) { 121 this.type = new EnumWrapper<AppItemTypeField>(AppItemTypeField.APP_ITEM); 122 } 123 return new AppItem(this); 124 } 125 } 126}