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