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