
uk.gov.justice.laa.crime.common.model.evidence.ApiIncomeEvidence Maven / Gradle / Ivy
package uk.gov.justice.laa.crime.common.model.evidence;
import java.time.LocalDate;
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;
import uk.gov.justice.laa.crime.enums.evidence.IncomeEvidenceType;
/**
* Income Evidence
*
* Information About an Income Evidence Item
*
*/
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonPropertyOrder({
"id",
"dateReceived",
"evidenceType",
"mandatory",
"description"
})
@Generated("jsonschema2pojo")
public class ApiIncomeEvidence {
/**
* The ID of the income evidence item
*
*/
@JsonProperty("id")
@JsonPropertyDescription("The ID of the income evidence item")
private Integer id;
/**
* The date the evidence was received
*
*/
@JsonProperty("dateReceived")
@JsonPropertyDescription("The date the evidence was received")
private LocalDate dateReceived;
/**
* The partners details
* (Required)
*
*/
@JsonProperty("evidenceType")
@JsonPropertyDescription("The partners details")
@Valid
@NotNull
private IncomeEvidenceType evidenceType;
/**
* Indicates whether the evidence is mandatory
* (Required)
*
*/
@JsonProperty("mandatory")
@JsonPropertyDescription("Indicates whether the evidence is mandatory")
@NotNull
private Boolean mandatory;
/**
* The evidence description (required for certain evidence types)
*
*/
@JsonProperty("description")
@JsonPropertyDescription("The evidence description (required for certain evidence types)")
private String description;
protected final static Object NOT_FOUND_VALUE = new Object();
/**
* No args constructor for use in serialization
*
*/
public ApiIncomeEvidence() {
}
/**
*
* @param dateReceived
* @param evidenceType
* @param description
* @param id
* @param mandatory
*/
public ApiIncomeEvidence(Integer id, LocalDate dateReceived, IncomeEvidenceType evidenceType, Boolean mandatory, String description) {
super();
this.id = id;
this.dateReceived = dateReceived;
this.evidenceType = evidenceType;
this.mandatory = mandatory;
this.description = description;
}
/**
* The ID of the income evidence item
*
*/
@JsonProperty("id")
public Integer getId() {
return id;
}
/**
* The ID of the income evidence item
*
*/
@JsonProperty("id")
public void setId(Integer id) {
this.id = id;
}
public ApiIncomeEvidence withId(Integer id) {
this.id = id;
return this;
}
/**
* The date the evidence was received
*
*/
@JsonProperty("dateReceived")
public LocalDate getDateReceived() {
return dateReceived;
}
/**
* The date the evidence was received
*
*/
@JsonProperty("dateReceived")
public void setDateReceived(LocalDate dateReceived) {
this.dateReceived = dateReceived;
}
public ApiIncomeEvidence withDateReceived(LocalDate dateReceived) {
this.dateReceived = dateReceived;
return this;
}
/**
* The partners details
* (Required)
*
*/
@JsonProperty("evidenceType")
public IncomeEvidenceType getEvidenceType() {
return evidenceType;
}
/**
* The partners details
* (Required)
*
*/
@JsonProperty("evidenceType")
public void setEvidenceType(IncomeEvidenceType evidenceType) {
this.evidenceType = evidenceType;
}
public ApiIncomeEvidence withEvidenceType(IncomeEvidenceType evidenceType) {
this.evidenceType = evidenceType;
return this;
}
/**
* Indicates whether the evidence is mandatory
* (Required)
*
*/
@JsonProperty("mandatory")
public Boolean getMandatory() {
return mandatory;
}
/**
* Indicates whether the evidence is mandatory
* (Required)
*
*/
@JsonProperty("mandatory")
public void setMandatory(Boolean mandatory) {
this.mandatory = mandatory;
}
public ApiIncomeEvidence withMandatory(Boolean mandatory) {
this.mandatory = mandatory;
return this;
}
/**
* The evidence description (required for certain evidence types)
*
*/
@JsonProperty("description")
public String getDescription() {
return description;
}
/**
* The evidence description (required for certain evidence types)
*
*/
@JsonProperty("description")
public void setDescription(String description) {
this.description = description;
}
public ApiIncomeEvidence withDescription(String description) {
this.description = description;
return this;
}
protected boolean declaredProperty(String name, Object value) {
if ("id".equals(name)) {
if (value instanceof Integer) {
setId(((Integer) value));
} else {
throw new IllegalArgumentException(("property \"id\" is of type \"java.lang.Integer\", but got "+ value.getClass().toString()));
}
return true;
} else {
if ("dateReceived".equals(name)) {
if (value instanceof LocalDate) {
setDateReceived(((LocalDate) value));
} else {
throw new IllegalArgumentException(("property \"dateReceived\" is of type \"java.time.LocalDate\", but got "+ value.getClass().toString()));
}
return true;
} else {
if ("evidenceType".equals(name)) {
if (value instanceof IncomeEvidenceType) {
setEvidenceType(((IncomeEvidenceType) value));
} else {
throw new IllegalArgumentException(("property \"evidenceType\" is of type \"uk.gov.justice.laa.crime.enums.evidence.IncomeEvidenceType\", but got "+ value.getClass().toString()));
}
return true;
} else {
if ("mandatory".equals(name)) {
if (value instanceof Boolean) {
setMandatory(((Boolean) value));
} else {
throw new IllegalArgumentException(("property \"mandatory\" is of type \"java.lang.Boolean\", but got "+ value.getClass().toString()));
}
return true;
} else {
if ("description".equals(name)) {
if (value instanceof String) {
setDescription(((String) value));
} else {
throw new IllegalArgumentException(("property \"description\" is of type \"java.lang.String\", but got "+ value.getClass().toString()));
}
return true;
} else {
return false;
}
}
}
}
}
}
protected Object declaredPropertyOrNotFound(String name, Object notFoundValue) {
if ("id".equals(name)) {
return getId();
} else {
if ("dateReceived".equals(name)) {
return getDateReceived();
} else {
if ("evidenceType".equals(name)) {
return getEvidenceType();
} else {
if ("mandatory".equals(name)) {
return getMandatory();
} else {
if ("description".equals(name)) {
return getDescription();
} else {
return notFoundValue;
}
}
}
}
}
}
@SuppressWarnings({
"unchecked"
})
publicT get(String name) {
Object value = declaredPropertyOrNotFound(name, ApiIncomeEvidence.NOT_FOUND_VALUE);
if (ApiIncomeEvidence.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 ApiIncomeEvidence 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(ApiIncomeEvidence.class.getName()).append('@').append(Integer.toHexString(System.identityHashCode(this))).append('[');
sb.append("id");
sb.append('=');
sb.append(((this.id == null)?"":this.id));
sb.append(',');
sb.append("dateReceived");
sb.append('=');
sb.append(((this.dateReceived == null)?"":this.dateReceived));
sb.append(',');
sb.append("evidenceType");
sb.append('=');
sb.append(((this.evidenceType == null)?"":this.evidenceType));
sb.append(',');
sb.append("mandatory");
sb.append('=');
sb.append(((this.mandatory == null)?"":this.mandatory));
sb.append(',');
sb.append("description");
sb.append('=');
sb.append(((this.description == null)?"":this.description));
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.dateReceived == null)? 0 :this.dateReceived.hashCode()));
result = ((result* 31)+((this.evidenceType == null)? 0 :this.evidenceType.hashCode()));
result = ((result* 31)+((this.description == null)? 0 :this.description.hashCode()));
result = ((result* 31)+((this.id == null)? 0 :this.id.hashCode()));
result = ((result* 31)+((this.mandatory == null)? 0 :this.mandatory.hashCode()));
return result;
}
@Override
public boolean equals(Object other) {
if (other == this) {
return true;
}
if ((other instanceof ApiIncomeEvidence) == false) {
return false;
}
ApiIncomeEvidence rhs = ((ApiIncomeEvidence) other);
return ((((((this.dateReceived == rhs.dateReceived)||((this.dateReceived!= null)&&this.dateReceived.equals(rhs.dateReceived)))&&((this.evidenceType == rhs.evidenceType)||((this.evidenceType!= null)&&this.evidenceType.equals(rhs.evidenceType))))&&((this.description == rhs.description)||((this.description!= null)&&this.description.equals(rhs.description))))&&((this.id == rhs.id)||((this.id!= null)&&this.id.equals(rhs.id))))&&((this.mandatory == rhs.mandatory)||((this.mandatory!= null)&&this.mandatory.equals(rhs.mandatory))));
}
}