001package com.box.sdkgen.schemas.retentionpolicybase; 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/** A base representation of a retention policy. */ 013@JsonFilter("nullablePropertyFilter") 014public class RetentionPolicyBase extends SerializableObject { 015 016 /** The unique identifier that represents a retention policy. */ 017 protected final String id; 018 019 /** The value will always be `retention_policy`. */ 020 @JsonDeserialize( 021 using = RetentionPolicyBaseTypeField.RetentionPolicyBaseTypeFieldDeserializer.class) 022 @JsonSerialize(using = RetentionPolicyBaseTypeField.RetentionPolicyBaseTypeFieldSerializer.class) 023 protected EnumWrapper<RetentionPolicyBaseTypeField> type; 024 025 public RetentionPolicyBase(@JsonProperty("id") String id) { 026 super(); 027 this.id = id; 028 this.type = 029 new EnumWrapper<RetentionPolicyBaseTypeField>( 030 RetentionPolicyBaseTypeField.RETENTION_POLICY); 031 } 032 033 protected RetentionPolicyBase(Builder builder) { 034 super(); 035 this.id = builder.id; 036 this.type = builder.type; 037 markNullableFieldsAsSet(builder.getExplicitlySetNullableFields()); 038 } 039 040 public String getId() { 041 return id; 042 } 043 044 public EnumWrapper<RetentionPolicyBaseTypeField> getType() { 045 return type; 046 } 047 048 @Override 049 public boolean equals(Object o) { 050 if (this == o) { 051 return true; 052 } 053 if (o == null || getClass() != o.getClass()) { 054 return false; 055 } 056 RetentionPolicyBase casted = (RetentionPolicyBase) o; 057 return Objects.equals(id, casted.id) && Objects.equals(type, casted.type); 058 } 059 060 @Override 061 public int hashCode() { 062 return Objects.hash(id, type); 063 } 064 065 @Override 066 public String toString() { 067 return "RetentionPolicyBase{" + "id='" + id + '\'' + ", " + "type='" + type + '\'' + "}"; 068 } 069 070 public static class Builder extends NullableFieldTracker { 071 072 protected final String id; 073 074 protected EnumWrapper<RetentionPolicyBaseTypeField> type; 075 076 public Builder(String id) { 077 super(); 078 this.id = id; 079 } 080 081 public Builder type(RetentionPolicyBaseTypeField type) { 082 this.type = new EnumWrapper<RetentionPolicyBaseTypeField>(type); 083 return this; 084 } 085 086 public Builder type(EnumWrapper<RetentionPolicyBaseTypeField> type) { 087 this.type = type; 088 return this; 089 } 090 091 public RetentionPolicyBase build() { 092 if (this.type == null) { 093 this.type = 094 new EnumWrapper<RetentionPolicyBaseTypeField>( 095 RetentionPolicyBaseTypeField.RETENTION_POLICY); 096 } 097 return new RetentionPolicyBase(this); 098 } 099 } 100}