com.tradeshift.sdk.assignments.domain.SaveAssignment Maven / Gradle / Ivy
The newest version!
/*
* Copyright (c) 2018 Tradeshift Inc. and/or its affiliates. All rights reserved.
*/
package com.tradeshift.sdk.assignments.domain;
import java.util.Objects;
import org.apache.commons.lang3.builder.ToStringBuilder;
import com.tradeshift.sdk.core.domain.Command;
import com.tradeshift.sdk.core.domain.ContextMsg;
import com.tradeshift.sdk.core.domain.UserContext;
public class SaveAssignment extends ContextMsg implements Command {
private final String mediaType;
private final Assignment assignment;
protected SaveAssignment(Builder builder) {
super(builder.userContext);
this.mediaType = Objects.requireNonNull(builder.mediaType);
this.assignment = Objects.requireNonNull(builder.assignment);
}
public String getMediaType() {
return mediaType;
}
public Assignment getAssignment() {
return assignment;
}
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
if (!super.equals(o)) {
return false;
}
final SaveAssignment cmd = (SaveAssignment) o;
return Objects.equals(mediaType, cmd.mediaType)
&& Objects.equals(assignment, cmd.assignment);
}
@Override
public int hashCode() {
return Objects.hash(super.hashCode(), mediaType, assignment);
}
@Override
public String toString() {
return ToStringBuilder.reflectionToString(this);
}
public static final class Builder {
private UserContext userContext;
private String mediaType;
private Assignment assignment;
public Builder withMediaType(String mediaType) {
this.mediaType = mediaType;
return this;
}
public Builder as(UserContext userContext) {
this.userContext = userContext;
return this;
}
public Builder withAssignment(Assignment assignment) {
this.assignment = assignment;
return this;
}
public SaveAssignment build() {
return new SaveAssignment(this);
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy