001package com.box.sdkgen.schemas.storagepolicy; 002 003import com.box.sdkgen.schemas.storagepolicymini.StoragePolicyMini; 004import com.box.sdkgen.schemas.storagepolicymini.StoragePolicyMiniTypeField; 005import com.box.sdkgen.serialization.json.EnumWrapper; 006import com.fasterxml.jackson.annotation.JsonFilter; 007import com.fasterxml.jackson.annotation.JsonProperty; 008import java.util.Objects; 009 010/** The Storage Policy object describes the storage zone. */ 011@JsonFilter("nullablePropertyFilter") 012public class StoragePolicy extends StoragePolicyMini { 013 014 /** A descriptive name of the region. */ 015 protected String name; 016 017 public StoragePolicy(@JsonProperty("id") String id) { 018 super(id); 019 } 020 021 protected StoragePolicy(Builder builder) { 022 super(builder); 023 this.name = builder.name; 024 markNullableFieldsAsSet(builder.getExplicitlySetNullableFields()); 025 } 026 027 public String getName() { 028 return name; 029 } 030 031 @Override 032 public boolean equals(Object o) { 033 if (this == o) { 034 return true; 035 } 036 if (o == null || getClass() != o.getClass()) { 037 return false; 038 } 039 StoragePolicy casted = (StoragePolicy) o; 040 return Objects.equals(id, casted.id) 041 && Objects.equals(type, casted.type) 042 && Objects.equals(name, casted.name); 043 } 044 045 @Override 046 public int hashCode() { 047 return Objects.hash(id, type, name); 048 } 049 050 @Override 051 public String toString() { 052 return "StoragePolicy{" 053 + "id='" 054 + id 055 + '\'' 056 + ", " 057 + "type='" 058 + type 059 + '\'' 060 + ", " 061 + "name='" 062 + name 063 + '\'' 064 + "}"; 065 } 066 067 public static class Builder extends StoragePolicyMini.Builder { 068 069 protected String name; 070 071 public Builder(String id) { 072 super(id); 073 } 074 075 public Builder name(String name) { 076 this.name = name; 077 return this; 078 } 079 080 @Override 081 public Builder type(StoragePolicyMiniTypeField type) { 082 this.type = new EnumWrapper<StoragePolicyMiniTypeField>(type); 083 return this; 084 } 085 086 @Override 087 public Builder type(EnumWrapper<StoragePolicyMiniTypeField> type) { 088 this.type = type; 089 return this; 090 } 091 092 public StoragePolicy build() { 093 if (this.type == null) { 094 this.type = 095 new EnumWrapper<StoragePolicyMiniTypeField>(StoragePolicyMiniTypeField.STORAGE_POLICY); 096 } 097 return new StoragePolicy(this); 098 } 099 } 100}