001package com.box.sdkgen.schemas.devicepinner; 002 003import com.box.sdkgen.internal.NullableFieldTracker; 004import com.box.sdkgen.internal.SerializableObject; 005import com.box.sdkgen.schemas.usermini.UserMini; 006import com.box.sdkgen.serialization.json.EnumWrapper; 007import com.fasterxml.jackson.annotation.JsonFilter; 008import com.fasterxml.jackson.annotation.JsonProperty; 009import com.fasterxml.jackson.databind.annotation.JsonDeserialize; 010import com.fasterxml.jackson.databind.annotation.JsonSerialize; 011import java.util.Objects; 012 013/** Device pins allow enterprises to control what devices can use native Box applications. */ 014@JsonFilter("nullablePropertyFilter") 015public class DevicePinner extends SerializableObject { 016 017 /** The unique identifier for this device pin. */ 018 protected String id; 019 020 /** The value will always be `device_pinner`. */ 021 @JsonDeserialize(using = DevicePinnerTypeField.DevicePinnerTypeFieldDeserializer.class) 022 @JsonSerialize(using = DevicePinnerTypeField.DevicePinnerTypeFieldSerializer.class) 023 protected EnumWrapper<DevicePinnerTypeField> type; 024 025 @JsonProperty("owned_by") 026 protected UserMini ownedBy; 027 028 /** The type of device being pinned. */ 029 @JsonProperty("product_name") 030 protected String productName; 031 032 public DevicePinner() { 033 super(); 034 } 035 036 protected DevicePinner(Builder builder) { 037 super(); 038 this.id = builder.id; 039 this.type = builder.type; 040 this.ownedBy = builder.ownedBy; 041 this.productName = builder.productName; 042 markNullableFieldsAsSet(builder.getExplicitlySetNullableFields()); 043 } 044 045 public String getId() { 046 return id; 047 } 048 049 public EnumWrapper<DevicePinnerTypeField> getType() { 050 return type; 051 } 052 053 public UserMini getOwnedBy() { 054 return ownedBy; 055 } 056 057 public String getProductName() { 058 return productName; 059 } 060 061 @Override 062 public boolean equals(Object o) { 063 if (this == o) { 064 return true; 065 } 066 if (o == null || getClass() != o.getClass()) { 067 return false; 068 } 069 DevicePinner casted = (DevicePinner) o; 070 return Objects.equals(id, casted.id) 071 && Objects.equals(type, casted.type) 072 && Objects.equals(ownedBy, casted.ownedBy) 073 && Objects.equals(productName, casted.productName); 074 } 075 076 @Override 077 public int hashCode() { 078 return Objects.hash(id, type, ownedBy, productName); 079 } 080 081 @Override 082 public String toString() { 083 return "DevicePinner{" 084 + "id='" 085 + id 086 + '\'' 087 + ", " 088 + "type='" 089 + type 090 + '\'' 091 + ", " 092 + "ownedBy='" 093 + ownedBy 094 + '\'' 095 + ", " 096 + "productName='" 097 + productName 098 + '\'' 099 + "}"; 100 } 101 102 public static class Builder extends NullableFieldTracker { 103 104 protected String id; 105 106 protected EnumWrapper<DevicePinnerTypeField> type; 107 108 protected UserMini ownedBy; 109 110 protected String productName; 111 112 public Builder id(String id) { 113 this.id = id; 114 return this; 115 } 116 117 public Builder type(DevicePinnerTypeField type) { 118 this.type = new EnumWrapper<DevicePinnerTypeField>(type); 119 return this; 120 } 121 122 public Builder type(EnumWrapper<DevicePinnerTypeField> type) { 123 this.type = type; 124 return this; 125 } 126 127 public Builder ownedBy(UserMini ownedBy) { 128 this.ownedBy = ownedBy; 129 return this; 130 } 131 132 public Builder productName(String productName) { 133 this.productName = productName; 134 return this; 135 } 136 137 public DevicePinner build() { 138 return new DevicePinner(this); 139 } 140 } 141}