001package com.box.sdkgen.schemas.metadatatemplate; 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.List; 011import java.util.Objects; 012 013@JsonFilter("nullablePropertyFilter") 014public class MetadataTemplateFieldsField extends SerializableObject { 015 016 /** 017 * The type of field. The basic fields are a `string` field for text, a `float` field for numbers, 018 * and a `date` fields to present the user with a date-time picker. 019 * 020 * <p>Additionally, metadata templates support an `enum` field for a basic list of items, and 021 * `multiSelect` field for a similar list of items where the user can select more than one value. 022 * 023 * <p>Metadata taxonomies are also supported as a `taxonomy` field type with a specific set of 024 * additional properties, which describe its structure. 025 * 026 * <p>**Note**: The `integer` value is deprecated. It is still present in the response, but cannot 027 * be used in the POST request. 028 */ 029 @JsonDeserialize( 030 using = MetadataTemplateFieldsTypeField.MetadataTemplateFieldsTypeFieldDeserializer.class) 031 @JsonSerialize( 032 using = MetadataTemplateFieldsTypeField.MetadataTemplateFieldsTypeFieldSerializer.class) 033 protected final EnumWrapper<MetadataTemplateFieldsTypeField> type; 034 035 /** 036 * A unique identifier for the field. The identifier must be unique within the template to which 037 * it belongs. 038 */ 039 protected final String key; 040 041 /** The display name of the field as it is shown to the user in the web and mobile apps. */ 042 protected final String displayName; 043 044 /** A description of the field. This is not shown to the user. */ 045 protected String description; 046 047 /** 048 * Whether this field is hidden in the UI for the user and can only be set through the API 049 * instead. 050 */ 051 protected Boolean hidden; 052 053 /** 054 * A list of options for this field. This is used in combination with the `enum` and `multiSelect` 055 * field types. 056 */ 057 protected List<MetadataTemplateFieldsOptionsField> options; 058 059 /** 060 * The unique key of the metadata taxonomy to use for this taxonomy field. This property is 061 * required when the field `type` is set to `taxonomy`. 062 */ 063 protected String taxonomyKey; 064 065 /** 066 * The unique ID of the metadata taxonomy to use for this taxonomy field. This property is 067 * required when the field `type` is set to `taxonomy`. 068 */ 069 protected String taxonomyId; 070 071 /** 072 * The namespace of the metadata taxonomy to use for this taxonomy field. This property is 073 * required when the field `type` is set to `taxonomy`. 074 */ 075 protected String namespace; 076 077 /** 078 * An object defining additional rules for the options of the taxonomy field. This property is 079 * required when the field `type` is set to `taxonomy`. 080 */ 081 protected MetadataTemplateFieldsOptionsRulesField optionsRules; 082 083 /** The unique ID of the metadata template field. */ 084 protected String id; 085 086 public MetadataTemplateFieldsField( 087 MetadataTemplateFieldsTypeField type, String key, String displayName) { 088 super(); 089 this.type = new EnumWrapper<MetadataTemplateFieldsTypeField>(type); 090 this.key = key; 091 this.displayName = displayName; 092 } 093 094 public MetadataTemplateFieldsField( 095 @JsonProperty("type") EnumWrapper<MetadataTemplateFieldsTypeField> type, 096 @JsonProperty("key") String key, 097 @JsonProperty("displayName") String displayName) { 098 super(); 099 this.type = type; 100 this.key = key; 101 this.displayName = displayName; 102 } 103 104 protected MetadataTemplateFieldsField(Builder builder) { 105 super(); 106 this.type = builder.type; 107 this.key = builder.key; 108 this.displayName = builder.displayName; 109 this.description = builder.description; 110 this.hidden = builder.hidden; 111 this.options = builder.options; 112 this.taxonomyKey = builder.taxonomyKey; 113 this.taxonomyId = builder.taxonomyId; 114 this.namespace = builder.namespace; 115 this.optionsRules = builder.optionsRules; 116 this.id = builder.id; 117 markNullableFieldsAsSet(builder.getExplicitlySetNullableFields()); 118 } 119 120 public EnumWrapper<MetadataTemplateFieldsTypeField> getType() { 121 return type; 122 } 123 124 public String getKey() { 125 return key; 126 } 127 128 public String getDisplayName() { 129 return displayName; 130 } 131 132 public String getDescription() { 133 return description; 134 } 135 136 public Boolean getHidden() { 137 return hidden; 138 } 139 140 public List<MetadataTemplateFieldsOptionsField> getOptions() { 141 return options; 142 } 143 144 public String getTaxonomyKey() { 145 return taxonomyKey; 146 } 147 148 public String getTaxonomyId() { 149 return taxonomyId; 150 } 151 152 public String getNamespace() { 153 return namespace; 154 } 155 156 public MetadataTemplateFieldsOptionsRulesField getOptionsRules() { 157 return optionsRules; 158 } 159 160 public String getId() { 161 return id; 162 } 163 164 @Override 165 public boolean equals(Object o) { 166 if (this == o) { 167 return true; 168 } 169 if (o == null || getClass() != o.getClass()) { 170 return false; 171 } 172 MetadataTemplateFieldsField casted = (MetadataTemplateFieldsField) o; 173 return Objects.equals(type, casted.type) 174 && Objects.equals(key, casted.key) 175 && Objects.equals(displayName, casted.displayName) 176 && Objects.equals(description, casted.description) 177 && Objects.equals(hidden, casted.hidden) 178 && Objects.equals(options, casted.options) 179 && Objects.equals(taxonomyKey, casted.taxonomyKey) 180 && Objects.equals(taxonomyId, casted.taxonomyId) 181 && Objects.equals(namespace, casted.namespace) 182 && Objects.equals(optionsRules, casted.optionsRules) 183 && Objects.equals(id, casted.id); 184 } 185 186 @Override 187 public int hashCode() { 188 return Objects.hash( 189 type, 190 key, 191 displayName, 192 description, 193 hidden, 194 options, 195 taxonomyKey, 196 taxonomyId, 197 namespace, 198 optionsRules, 199 id); 200 } 201 202 @Override 203 public String toString() { 204 return "MetadataTemplateFieldsField{" 205 + "type='" 206 + type 207 + '\'' 208 + ", " 209 + "key='" 210 + key 211 + '\'' 212 + ", " 213 + "displayName='" 214 + displayName 215 + '\'' 216 + ", " 217 + "description='" 218 + description 219 + '\'' 220 + ", " 221 + "hidden='" 222 + hidden 223 + '\'' 224 + ", " 225 + "options='" 226 + options 227 + '\'' 228 + ", " 229 + "taxonomyKey='" 230 + taxonomyKey 231 + '\'' 232 + ", " 233 + "taxonomyId='" 234 + taxonomyId 235 + '\'' 236 + ", " 237 + "namespace='" 238 + namespace 239 + '\'' 240 + ", " 241 + "optionsRules='" 242 + optionsRules 243 + '\'' 244 + ", " 245 + "id='" 246 + id 247 + '\'' 248 + "}"; 249 } 250 251 public static class Builder extends NullableFieldTracker { 252 253 protected final EnumWrapper<MetadataTemplateFieldsTypeField> type; 254 255 protected final String key; 256 257 protected final String displayName; 258 259 protected String description; 260 261 protected Boolean hidden; 262 263 protected List<MetadataTemplateFieldsOptionsField> options; 264 265 protected String taxonomyKey; 266 267 protected String taxonomyId; 268 269 protected String namespace; 270 271 protected MetadataTemplateFieldsOptionsRulesField optionsRules; 272 273 protected String id; 274 275 public Builder(MetadataTemplateFieldsTypeField type, String key, String displayName) { 276 super(); 277 this.type = new EnumWrapper<MetadataTemplateFieldsTypeField>(type); 278 this.key = key; 279 this.displayName = displayName; 280 } 281 282 public Builder( 283 EnumWrapper<MetadataTemplateFieldsTypeField> type, String key, String displayName) { 284 super(); 285 this.type = type; 286 this.key = key; 287 this.displayName = displayName; 288 } 289 290 public Builder description(String description) { 291 this.description = description; 292 return this; 293 } 294 295 public Builder hidden(Boolean hidden) { 296 this.hidden = hidden; 297 return this; 298 } 299 300 public Builder options(List<MetadataTemplateFieldsOptionsField> options) { 301 this.options = options; 302 return this; 303 } 304 305 public Builder taxonomyKey(String taxonomyKey) { 306 this.taxonomyKey = taxonomyKey; 307 return this; 308 } 309 310 public Builder taxonomyId(String taxonomyId) { 311 this.taxonomyId = taxonomyId; 312 return this; 313 } 314 315 public Builder namespace(String namespace) { 316 this.namespace = namespace; 317 return this; 318 } 319 320 public Builder optionsRules(MetadataTemplateFieldsOptionsRulesField optionsRules) { 321 this.optionsRules = optionsRules; 322 return this; 323 } 324 325 public Builder id(String id) { 326 this.id = id; 327 return this; 328 } 329 330 public MetadataTemplateFieldsField build() { 331 return new MetadataTemplateFieldsField(this); 332 } 333 } 334}