001package com.box.sdkgen.schemas.outcome; 002 003import com.box.sdkgen.internal.NullableFieldTracker; 004import com.box.sdkgen.internal.SerializableObject; 005import com.box.sdkgen.schemas.collaboratorvariable.CollaboratorVariable; 006import com.box.sdkgen.schemas.completionrulevariable.CompletionRuleVariable; 007import com.box.sdkgen.schemas.rolevariable.RoleVariable; 008import com.fasterxml.jackson.annotation.JsonFilter; 009import com.fasterxml.jackson.annotation.JsonProperty; 010import java.util.Objects; 011 012/** An instance of an outcome. */ 013@JsonFilter("nullablePropertyFilter") 014public class Outcome extends SerializableObject { 015 016 /** ID of a specific outcome. */ 017 protected final String id; 018 019 protected CollaboratorVariable collaborators; 020 021 @JsonProperty("completion_rule") 022 protected CompletionRuleVariable completionRule; 023 024 @JsonProperty("file_collaborator_role") 025 protected RoleVariable fileCollaboratorRole; 026 027 @JsonProperty("task_collaborators") 028 protected CollaboratorVariable taskCollaborators; 029 030 protected RoleVariable role; 031 032 public Outcome(@JsonProperty("id") String id) { 033 super(); 034 this.id = id; 035 } 036 037 protected Outcome(Builder builder) { 038 super(); 039 this.id = builder.id; 040 this.collaborators = builder.collaborators; 041 this.completionRule = builder.completionRule; 042 this.fileCollaboratorRole = builder.fileCollaboratorRole; 043 this.taskCollaborators = builder.taskCollaborators; 044 this.role = builder.role; 045 markNullableFieldsAsSet(builder.getExplicitlySetNullableFields()); 046 } 047 048 public String getId() { 049 return id; 050 } 051 052 public CollaboratorVariable getCollaborators() { 053 return collaborators; 054 } 055 056 public CompletionRuleVariable getCompletionRule() { 057 return completionRule; 058 } 059 060 public RoleVariable getFileCollaboratorRole() { 061 return fileCollaboratorRole; 062 } 063 064 public CollaboratorVariable getTaskCollaborators() { 065 return taskCollaborators; 066 } 067 068 public RoleVariable getRole() { 069 return role; 070 } 071 072 @Override 073 public boolean equals(Object o) { 074 if (this == o) { 075 return true; 076 } 077 if (o == null || getClass() != o.getClass()) { 078 return false; 079 } 080 Outcome casted = (Outcome) o; 081 return Objects.equals(id, casted.id) 082 && Objects.equals(collaborators, casted.collaborators) 083 && Objects.equals(completionRule, casted.completionRule) 084 && Objects.equals(fileCollaboratorRole, casted.fileCollaboratorRole) 085 && Objects.equals(taskCollaborators, casted.taskCollaborators) 086 && Objects.equals(role, casted.role); 087 } 088 089 @Override 090 public int hashCode() { 091 return Objects.hash( 092 id, collaborators, completionRule, fileCollaboratorRole, taskCollaborators, role); 093 } 094 095 @Override 096 public String toString() { 097 return "Outcome{" 098 + "id='" 099 + id 100 + '\'' 101 + ", " 102 + "collaborators='" 103 + collaborators 104 + '\'' 105 + ", " 106 + "completionRule='" 107 + completionRule 108 + '\'' 109 + ", " 110 + "fileCollaboratorRole='" 111 + fileCollaboratorRole 112 + '\'' 113 + ", " 114 + "taskCollaborators='" 115 + taskCollaborators 116 + '\'' 117 + ", " 118 + "role='" 119 + role 120 + '\'' 121 + "}"; 122 } 123 124 public static class Builder extends NullableFieldTracker { 125 126 protected final String id; 127 128 protected CollaboratorVariable collaborators; 129 130 protected CompletionRuleVariable completionRule; 131 132 protected RoleVariable fileCollaboratorRole; 133 134 protected CollaboratorVariable taskCollaborators; 135 136 protected RoleVariable role; 137 138 public Builder(String id) { 139 super(); 140 this.id = id; 141 } 142 143 public Builder collaborators(CollaboratorVariable collaborators) { 144 this.collaborators = collaborators; 145 return this; 146 } 147 148 public Builder completionRule(CompletionRuleVariable completionRule) { 149 this.completionRule = completionRule; 150 return this; 151 } 152 153 public Builder fileCollaboratorRole(RoleVariable fileCollaboratorRole) { 154 this.fileCollaboratorRole = fileCollaboratorRole; 155 return this; 156 } 157 158 public Builder taskCollaborators(CollaboratorVariable taskCollaborators) { 159 this.taskCollaborators = taskCollaborators; 160 return this; 161 } 162 163 public Builder role(RoleVariable role) { 164 this.role = role; 165 return this; 166 } 167 168 public Outcome build() { 169 return new Outcome(this); 170 } 171 } 172}