001package com.box.sdkgen.schemas.metadatabase; 002 003import com.box.sdkgen.internal.NullableFieldTracker; 004import com.box.sdkgen.internal.SerializableObject; 005import com.fasterxml.jackson.annotation.JsonFilter; 006import com.fasterxml.jackson.annotation.JsonProperty; 007import java.util.Objects; 008 009/** The base representation of a metadata instance. */ 010@JsonFilter("nullablePropertyFilter") 011public class MetadataBase extends SerializableObject { 012 013 /** 014 * The identifier of the item that this metadata instance has been attached to. This combines the 015 * `type` and the `id` of the parent in the form `{type}_{id}`. 016 */ 017 @JsonProperty("$parent") 018 protected String parent; 019 020 /** The name of the template. */ 021 @JsonProperty("$template") 022 protected String template; 023 024 /** 025 * An ID for the scope in which this template has been applied. This will be 026 * `enterprise_{enterprise_id}` for templates defined for use in this enterprise, and `global` for 027 * general templates that are available to all enterprises using Box. 028 */ 029 @JsonProperty("$scope") 030 protected String scope; 031 032 /** 033 * The version of the metadata instance. This version starts at 0 and increases every time a 034 * user-defined property is modified. 035 */ 036 @JsonProperty("$version") 037 protected Long version; 038 039 public MetadataBase() { 040 super(); 041 } 042 043 protected MetadataBase(Builder builder) { 044 super(); 045 this.parent = builder.parent; 046 this.template = builder.template; 047 this.scope = builder.scope; 048 this.version = builder.version; 049 markNullableFieldsAsSet(builder.getExplicitlySetNullableFields()); 050 } 051 052 public String getParent() { 053 return parent; 054 } 055 056 public String getTemplate() { 057 return template; 058 } 059 060 public String getScope() { 061 return scope; 062 } 063 064 public Long getVersion() { 065 return version; 066 } 067 068 @Override 069 public boolean equals(Object o) { 070 if (this == o) { 071 return true; 072 } 073 if (o == null || getClass() != o.getClass()) { 074 return false; 075 } 076 MetadataBase casted = (MetadataBase) o; 077 return Objects.equals(parent, casted.parent) 078 && Objects.equals(template, casted.template) 079 && Objects.equals(scope, casted.scope) 080 && Objects.equals(version, casted.version); 081 } 082 083 @Override 084 public int hashCode() { 085 return Objects.hash(parent, template, scope, version); 086 } 087 088 @Override 089 public String toString() { 090 return "MetadataBase{" 091 + "parent='" 092 + parent 093 + '\'' 094 + ", " 095 + "template='" 096 + template 097 + '\'' 098 + ", " 099 + "scope='" 100 + scope 101 + '\'' 102 + ", " 103 + "version='" 104 + version 105 + '\'' 106 + "}"; 107 } 108 109 public static class Builder extends NullableFieldTracker { 110 111 protected String parent; 112 113 protected String template; 114 115 protected String scope; 116 117 protected Long version; 118 119 public Builder parent(String parent) { 120 this.parent = parent; 121 return this; 122 } 123 124 public Builder template(String template) { 125 this.template = template; 126 return this; 127 } 128 129 public Builder scope(String scope) { 130 this.scope = scope; 131 return this; 132 } 133 134 public Builder version(Long version) { 135 this.version = version; 136 return this; 137 } 138 139 public MetadataBase build() { 140 return new MetadataBase(this); 141 } 142 } 143}