All Downloads are FREE. Search and download functionalities are using the official Maven repository.

uk.gov.justice.laa.crime.common.model.hardship.HardshipCost 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.Frequency;


/**
 * The hardship cost schema
 * 

* Details of hardship cost * */ @JsonInclude(JsonInclude.Include.NON_NULL) @JsonPropertyOrder({ "accepted", "frequency" }) @Generated("jsonschema2pojo") public class HardshipCost extends HardshipDetail { /** * Indicates whether the additional cost has been accepted * */ @JsonProperty("accepted") @JsonPropertyDescription("Indicates whether the additional cost has been accepted") private Boolean accepted; /** * Hardship payment frequency * */ @JsonProperty("frequency") @JsonPropertyDescription("Hardship payment frequency") @Valid private Frequency frequency; @JsonIgnore @Valid private Map additionalProperties = new LinkedHashMap(); protected final static Object NOT_FOUND_VALUE = new Object(); /** * No args constructor for use in serialization * */ public HardshipCost() { } /** * * @param amount * @param accepted * @param description * @param frequency */ public HardshipCost(Boolean accepted, Frequency frequency, BigDecimal amount, String description) { super(amount, description); this.accepted = accepted; this.frequency = frequency; } /** * Indicates whether the additional cost has been accepted * */ @JsonProperty("accepted") public Boolean getAccepted() { return accepted; } /** * Indicates whether the additional cost has been accepted * */ @JsonProperty("accepted") public void setAccepted(Boolean accepted) { this.accepted = accepted; } public HardshipCost withAccepted(Boolean accepted) { this.accepted = accepted; return this; } /** * Hardship payment frequency * */ @JsonProperty("frequency") public Frequency getFrequency() { return frequency; } /** * Hardship payment frequency * */ @JsonProperty("frequency") public void setFrequency(Frequency frequency) { this.frequency = frequency; } public HardshipCost withFrequency(Frequency frequency) { this.frequency = frequency; return this; } @Override public HardshipCost withAmount(BigDecimal amount) { super.withAmount(amount); return this; } @Override public HardshipCost 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 HardshipCost withAdditionalProperty(String name, Object value) { this.additionalProperties.put(name, value); return this; } protected boolean declaredProperty(String name, Object value) { if ("accepted".equals(name)) { if (value instanceof Boolean) { setAccepted(((Boolean) value)); } else { throw new IllegalArgumentException(("property \"accepted\" is of type \"java.lang.Boolean\", but got "+ value.getClass().toString())); } return true; } else { if ("frequency".equals(name)) { if (value instanceof Frequency) { setFrequency(((Frequency) value)); } else { throw new IllegalArgumentException(("property \"frequency\" is of type \"uk.gov.justice.laa.crime.enums.Frequency\", but got "+ value.getClass().toString())); } return true; } else { return super.declaredProperty(name, value); } } } protected Object declaredPropertyOrNotFound(String name, Object notFoundValue) { if ("accepted".equals(name)) { return getAccepted(); } else { if ("frequency".equals(name)) { return getFrequency(); } else { return super.declaredPropertyOrNotFound(name, notFoundValue); } } } @SuppressWarnings({ "unchecked" }) publicT get(String name) { Object value = declaredPropertyOrNotFound(name, HardshipCost.NOT_FOUND_VALUE); if (HardshipCost.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 HardshipCost 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(HardshipCost.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("accepted"); sb.append('='); sb.append(((this.accepted == null)?"":this.accepted)); sb.append(','); sb.append("frequency"); sb.append('='); sb.append(((this.frequency == null)?"":this.frequency)); 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.accepted == null)? 0 :this.accepted.hashCode())); result = ((result* 31)+((this.additionalProperties == null)? 0 :this.additionalProperties.hashCode())); result = ((result* 31)+((this.frequency == null)? 0 :this.frequency.hashCode())); result = ((result* 31)+ super.hashCode()); return result; } @Override public boolean equals(Object other) { if (other == this) { return true; } if ((other instanceof HardshipCost) == false) { return false; } HardshipCost rhs = ((HardshipCost) other); return (((super.equals(rhs)&&((this.accepted == rhs.accepted)||((this.accepted!= null)&&this.accepted.equals(rhs.accepted))))&&((this.additionalProperties == rhs.additionalProperties)||((this.additionalProperties!= null)&&this.additionalProperties.equals(rhs.additionalProperties))))&&((this.frequency == rhs.frequency)||((this.frequency!= null)&&this.frequency.equals(rhs.frequency)))); } }





© 2015 - 2025 Weber Informatics LLC | Privacy Policy