
uk.gov.justice.laa.crime.common.model.hardship.ApiCalculateHardshipRequest Maven / Gradle / Ivy
package uk.gov.justice.laa.crime.common.model.hardship;
import javax.annotation.processing.Generated;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonPropertyDescription;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
import jakarta.validation.Valid;
import jakarta.validation.constraints.NotNull;
/**
* Calculate Hardship Request
*
* Data contract for calculate Hardship Review request
*
*/
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonPropertyOrder({
"hardship"
})
@Generated("jsonschema2pojo")
public class ApiCalculateHardshipRequest {
/**
* Hardship Review
*
* Hardship Review Data
* (Required)
*
*/
@JsonProperty("hardship")
@JsonPropertyDescription("Hardship Review Data")
@Valid
@NotNull
private HardshipReview hardship;
protected final static Object NOT_FOUND_VALUE = new Object();
/**
* No args constructor for use in serialization
*
*/
public ApiCalculateHardshipRequest() {
}
/**
*
* @param hardship
*/
public ApiCalculateHardshipRequest(HardshipReview hardship) {
super();
this.hardship = hardship;
}
/**
* Hardship Review
*
* Hardship Review Data
* (Required)
*
*/
@JsonProperty("hardship")
public HardshipReview getHardship() {
return hardship;
}
/**
* Hardship Review
*
* Hardship Review Data
* (Required)
*
*/
@JsonProperty("hardship")
public void setHardship(HardshipReview hardship) {
this.hardship = hardship;
}
public ApiCalculateHardshipRequest withHardship(HardshipReview hardship) {
this.hardship = hardship;
return this;
}
protected boolean declaredProperty(String name, Object value) {
if ("hardship".equals(name)) {
if (value instanceof HardshipReview) {
setHardship(((HardshipReview) value));
} else {
throw new IllegalArgumentException(("property \"hardship\" is of type \"uk.gov.justice.laa.crime.common.model.hardship.HardshipReview\", but got "+ value.getClass().toString()));
}
return true;
} else {
return false;
}
}
protected Object declaredPropertyOrNotFound(String name, Object notFoundValue) {
if ("hardship".equals(name)) {
return getHardship();
} else {
return notFoundValue;
}
}
@SuppressWarnings({
"unchecked"
})
publicT get(String name) {
Object value = declaredPropertyOrNotFound(name, ApiCalculateHardshipRequest.NOT_FOUND_VALUE);
if (ApiCalculateHardshipRequest.NOT_FOUND_VALUE!= value) {
return ((T) value);
} else {
throw new IllegalArgumentException((("property \""+ name)+"\" is not defined"));
}
}
public void set(String name, Object value) {
if (!declaredProperty(name, value)) {
throw new IllegalArgumentException((("property \""+ name)+"\" is not defined"));
}
}
public ApiCalculateHardshipRequest with(String name, Object value) {
if (!declaredProperty(name, value)) {
throw new IllegalArgumentException((("property \""+ name)+"\" is not defined"));
}
return this;
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append(ApiCalculateHardshipRequest.class.getName()).append('@').append(Integer.toHexString(System.identityHashCode(this))).append('[');
sb.append("hardship");
sb.append('=');
sb.append(((this.hardship == null)?"":this.hardship));
sb.append(',');
if (sb.charAt((sb.length()- 1)) == ',') {
sb.setCharAt((sb.length()- 1), ']');
} else {
sb.append(']');
}
return sb.toString();
}
@Override
public int hashCode() {
int result = 1;
result = ((result* 31)+((this.hardship == null)? 0 :this.hardship.hashCode()));
return result;
}
@Override
public boolean equals(Object other) {
if (other == this) {
return true;
}
if ((other instanceof ApiCalculateHardshipRequest) == false) {
return false;
}
ApiCalculateHardshipRequest rhs = ((ApiCalculateHardshipRequest) other);
return ((this.hardship == rhs.hardship)||((this.hardship!= null)&&this.hardship.equals(rhs.hardship)));
}
}