
uk.gov.justice.laa.crime.common.model.hardship.DeniedIncome Maven / Gradle / Ivy
package uk.gov.justice.laa.crime.common.model.hardship;
import java.math.BigDecimal;
import java.util.LinkedHashMap;
import java.util.Map;
import javax.annotation.processing.Generated;
import com.fasterxml.jackson.annotation.JsonAnyGetter;
import com.fasterxml.jackson.annotation.JsonAnySetter;
import com.fasterxml.jackson.annotation.JsonIgnore;
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 uk.gov.justice.laa.crime.enums.DeniedIncomeDetailCode;
import uk.gov.justice.laa.crime.enums.Frequency;
/**
* The denied income schema
*
* Details of denied income
*
*/
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonPropertyOrder({
"reasonNote",
"itemCode"
})
@Generated("jsonschema2pojo")
public class DeniedIncome
extends HardshipCost
{
/**
* The denied income reason note
*
*/
@JsonProperty("reasonNote")
@JsonPropertyDescription("The denied income reason note")
private String reasonNote;
/**
* The hardship denied income codes
*
*/
@JsonProperty("itemCode")
@JsonPropertyDescription("The hardship denied income codes")
@Valid
private DeniedIncomeDetailCode itemCode;
@JsonIgnore
@Valid
private Map additionalProperties = new LinkedHashMap();
protected final static Object NOT_FOUND_VALUE = new Object();
/**
* No args constructor for use in serialization
*
*/
public DeniedIncome() {
}
/**
*
* @param amount
* @param itemCode
* @param reasonNote
* @param accepted
* @param description
* @param frequency
*/
public DeniedIncome(String reasonNote, DeniedIncomeDetailCode itemCode, Boolean accepted, Frequency frequency, BigDecimal amount, String description) {
super(accepted, frequency, amount, description);
this.reasonNote = reasonNote;
this.itemCode = itemCode;
}
/**
* The denied income reason note
*
*/
@JsonProperty("reasonNote")
public String getReasonNote() {
return reasonNote;
}
/**
* The denied income reason note
*
*/
@JsonProperty("reasonNote")
public void setReasonNote(String reasonNote) {
this.reasonNote = reasonNote;
}
public DeniedIncome withReasonNote(String reasonNote) {
this.reasonNote = reasonNote;
return this;
}
/**
* The hardship denied income codes
*
*/
@JsonProperty("itemCode")
public DeniedIncomeDetailCode getItemCode() {
return itemCode;
}
/**
* The hardship denied income codes
*
*/
@JsonProperty("itemCode")
public void setItemCode(DeniedIncomeDetailCode itemCode) {
this.itemCode = itemCode;
}
public DeniedIncome withItemCode(DeniedIncomeDetailCode itemCode) {
this.itemCode = itemCode;
return this;
}
@Override
public DeniedIncome withAccepted(Boolean accepted) {
super.withAccepted(accepted);
return this;
}
@Override
public DeniedIncome withFrequency(Frequency frequency) {
super.withFrequency(frequency);
return this;
}
@Override
public DeniedIncome withAmount(BigDecimal amount) {
super.withAmount(amount);
return this;
}
@Override
public DeniedIncome withDescription(String description) {
super.withDescription(description);
return this;
}
@JsonAnyGetter
public Map getAdditionalProperties() {
return this.additionalProperties;
}
@JsonAnySetter
public void setAdditionalProperty(String name, Object value) {
this.additionalProperties.put(name, value);
}
public DeniedIncome withAdditionalProperty(String name, Object value) {
this.additionalProperties.put(name, value);
return this;
}
protected boolean declaredProperty(String name, Object value) {
if ("reasonNote".equals(name)) {
if (value instanceof String) {
setReasonNote(((String) value));
} else {
throw new IllegalArgumentException(("property \"reasonNote\" is of type \"java.lang.String\", but got "+ value.getClass().toString()));
}
return true;
} else {
if ("itemCode".equals(name)) {
if (value instanceof DeniedIncomeDetailCode) {
setItemCode(((DeniedIncomeDetailCode) value));
} else {
throw new IllegalArgumentException(("property \"itemCode\" is of type \"uk.gov.justice.laa.crime.enums.DeniedIncomeDetailCode\", but got "+ value.getClass().toString()));
}
return true;
} else {
return super.declaredProperty(name, value);
}
}
}
protected Object declaredPropertyOrNotFound(String name, Object notFoundValue) {
if ("reasonNote".equals(name)) {
return getReasonNote();
} else {
if ("itemCode".equals(name)) {
return getItemCode();
} else {
return super.declaredPropertyOrNotFound(name, notFoundValue);
}
}
}
@SuppressWarnings({
"unchecked"
})
publicT get(String name) {
Object value = declaredPropertyOrNotFound(name, DeniedIncome.NOT_FOUND_VALUE);
if (DeniedIncome.NOT_FOUND_VALUE!= value) {
return ((T) value);
} else {
return ((T) getAdditionalProperties().get(name));
}
}
public void set(String name, Object value) {
if (!declaredProperty(name, value)) {
getAdditionalProperties().put(name, ((Object) value));
}
}
public DeniedIncome with(String name, Object value) {
if (!declaredProperty(name, value)) {
getAdditionalProperties().put(name, ((Object) value));
}
return this;
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append(DeniedIncome.class.getName()).append('@').append(Integer.toHexString(System.identityHashCode(this))).append('[');
int baseLength = sb.length();
String superString = super.toString();
if (superString!= null) {
int contentStart = superString.indexOf('[');
int contentEnd = superString.lastIndexOf(']');
if ((contentStart >= 0)&&(contentEnd >contentStart)) {
sb.append(superString, (contentStart + 1), contentEnd);
} else {
sb.append(superString);
}
}
if (sb.length()>baseLength) {
sb.append(',');
}
sb.append("reasonNote");
sb.append('=');
sb.append(((this.reasonNote == null)?"":this.reasonNote));
sb.append(',');
sb.append("itemCode");
sb.append('=');
sb.append(((this.itemCode == null)?"":this.itemCode));
sb.append(',');
sb.append("additionalProperties");
sb.append('=');
sb.append(((this.additionalProperties == null)?"":this.additionalProperties));
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.reasonNote == null)? 0 :this.reasonNote.hashCode()));
result = ((result* 31)+((this.additionalProperties == null)? 0 :this.additionalProperties.hashCode()));
result = ((result* 31)+((this.itemCode == null)? 0 :this.itemCode.hashCode()));
result = ((result* 31)+ super.hashCode());
return result;
}
@Override
public boolean equals(Object other) {
if (other == this) {
return true;
}
if ((other instanceof DeniedIncome) == false) {
return false;
}
DeniedIncome rhs = ((DeniedIncome) other);
return (((super.equals(rhs)&&((this.reasonNote == rhs.reasonNote)||((this.reasonNote!= null)&&this.reasonNote.equals(rhs.reasonNote))))&&((this.additionalProperties == rhs.additionalProperties)||((this.additionalProperties!= null)&&this.additionalProperties.equals(rhs.additionalProperties))))&&((this.itemCode == rhs.itemCode)||((this.itemCode!= null)&&this.itemCode.equals(rhs.itemCode))));
}
}