io.phasetwo.service.representation.Team Maven / Gradle / Ivy
package io.phasetwo.service.representation;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import jakarta.validation.Valid;
import jakarta.validation.constraints.*;
import java.util.List;
import java.util.Map;
import java.util.Objects;
public class Team {
private @Valid String id = null;
// private @Valid Integer membersCount = null;
private @Valid String name = null;
private @Valid String organizationId = null;
private @Valid Map> attributes = Maps.newHashMap();
/** */
public Team id(String id) {
this.id = id;
return this;
}
@JsonProperty("id")
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
/** */
public Team name(String name) {
this.name = name;
return this;
}
@JsonProperty("name")
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
/** */
public Team organizationId(String organizationId) {
this.organizationId = organizationId;
return this;
}
@JsonProperty("organizationId")
public String getOrganizationId() {
return organizationId;
}
public void setOrganizationId(String organizationId) {
this.organizationId = organizationId;
}
public Team attribute(String name, String value) {
List list = this.attributes.get(name);
if (list == null) {
list = Lists.newArrayList();
}
if (!list.contains(value)) list.add(value);
this.attributes.put(name, list);
return this;
}
@JsonProperty("attributes")
public Map> getAttributes() {
return attributes;
}
public void setAttributes(Map> attributes) {
this.attributes = attributes;
}
@Override
public boolean equals(java.lang.Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
Team team = (Team) o;
return Objects.equals(id, team.id)
&& Objects.equals(name, team.name)
&& Objects.equals(organizationId, team.organizationId)
&& Objects.equals(attributes, team.attributes);
}
@Override
public int hashCode() {
return Objects.hash(id, name, organizationId, attributes);
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class Team {\n");
sb.append(" id: ").append(toIndentedString(id)).append("\n");
sb.append(" name: ").append(toIndentedString(name)).append("\n");
sb.append(" organizationId: ").append(toIndentedString(organizationId)).append("\n");
sb.append(" attributes: ").append(toIndentedString(attributes)).append("\n");
sb.append("}");
return sb.toString();
}
/**
* Convert the given object to string with each line indented by 4 spaces (except the first line).
*/
private String toIndentedString(java.lang.Object o) {
if (o == null) {
return "null";
}
return o.toString().replace("\n", "\n ");
}
}