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

uk.gov.justice.laa.crime.common.model.maatapi.ApiFrequency Maven / Gradle / Ivy


package uk.gov.justice.laa.crime.common.model.maatapi;

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.constraints.NotNull;


/**
 * The Frequency
 * 
 */
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonPropertyOrder({
    "code",
    "description"
})
@Generated("jsonschema2pojo")
public class ApiFrequency {

    /**
     * This wll have the frequency code of the selection
     * (Required)
     * 
     */
    @JsonProperty("code")
    @JsonPropertyDescription("This wll have the frequency code of the selection")
    @NotNull
    private String code;
    /**
     * Frequency 
     * 
     */
    @JsonProperty("description")
    @JsonPropertyDescription("Frequency ")
    private String description;
    protected final static Object NOT_FOUND_VALUE = new Object();

    /**
     * No args constructor for use in serialization
     * 
     */
    public ApiFrequency() {
    }

    /**
     * 
     * @param code
     * @param description
     */
    public ApiFrequency(String code, String description) {
        super();
        this.code = code;
        this.description = description;
    }

    /**
     * This wll have the frequency code of the selection
     * (Required)
     * 
     */
    @JsonProperty("code")
    public String getCode() {
        return code;
    }

    /**
     * This wll have the frequency code of the selection
     * (Required)
     * 
     */
    @JsonProperty("code")
    public void setCode(String code) {
        this.code = code;
    }

    public ApiFrequency withCode(String code) {
        this.code = code;
        return this;
    }

    /**
     * Frequency 
     * 
     */
    @JsonProperty("description")
    public String getDescription() {
        return description;
    }

    /**
     * Frequency 
     * 
     */
    @JsonProperty("description")
    public void setDescription(String description) {
        this.description = description;
    }

    public ApiFrequency withDescription(String description) {
        this.description = description;
        return this;
    }

    protected boolean declaredProperty(String name, Object value) {
        if ("code".equals(name)) {
            if (value instanceof String) {
                setCode(((String) value));
            } else {
                throw new IllegalArgumentException(("property \"code\" is of type \"java.lang.String\", 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 ("code".equals(name)) {
            return getCode();
        } else {
            if ("description".equals(name)) {
                return getDescription();
            } else {
                return notFoundValue;
            }
        }
    }

    @SuppressWarnings({
        "unchecked"
    })
    publicT get(String name) {
        Object value = declaredPropertyOrNotFound(name, ApiFrequency.NOT_FOUND_VALUE);
        if (ApiFrequency.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 ApiFrequency 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(ApiFrequency.class.getName()).append('@').append(Integer.toHexString(System.identityHashCode(this))).append('[');
        sb.append("code");
        sb.append('=');
        sb.append(((this.code == null)?"":this.code));
        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.description == null)? 0 :this.description.hashCode()));
        result = ((result* 31)+((this.code == null)? 0 :this.code.hashCode()));
        return result;
    }

    @Override
    public boolean equals(Object other) {
        if (other == this) {
            return true;
        }
        if ((other instanceof ApiFrequency) == false) {
            return false;
        }
        ApiFrequency rhs = ((ApiFrequency) other);
        return (((this.description == rhs.description)||((this.description!= null)&&this.description.equals(rhs.description)))&&((this.code == rhs.code)||((this.code!= null)&&this.code.equals(rhs.code))));
    }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy