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

com.hopper.cloud.airlines.model.CfarTax Maven / Gradle / Ivy

The newest version!
/*
 * Airline API
 * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
 *
 * The version of the OpenAPI document: v1.0
 *
 *
 * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
 * https://openapi-generator.tech
 * Do not edit the class manually.
 */


package com.hopper.cloud.airlines.model;

import com.fasterxml.jackson.annotation.JsonInclude;
import com.google.gson.*;
import com.google.gson.annotations.SerializedName;
import com.google.gson.reflect.TypeToken;
import com.google.gson.stream.JsonReader;
import com.google.gson.stream.JsonWriter;
import com.hopper.cloud.airlines.JSON;
import io.swagger.annotations.ApiModel;

import java.io.IOException;
import java.util.HashSet;
import java.util.Map.Entry;
import java.util.Objects;
import java.util.Set;

/**
 * An object detailing a tax
 */
@ApiModel(description = "An object detailing a tax")
@JsonInclude(JsonInclude.Include.NON_NULL)
public class CfarTax {
    public static final String SERIALIZED_NAME_NAME = "name";
    @SerializedName(SERIALIZED_NAME_NAME)
    private String name;

    public static final String SERIALIZED_NAME_RATE = "rate";
    @SerializedName(SERIALIZED_NAME_RATE)
    private String rate;

    public static final String SERIALIZED_NAME_AMOUNT = "amount";
    @SerializedName(SERIALIZED_NAME_AMOUNT)
    private String amount;

    public static final String SERIALIZED_NAME_ESTIMATED = "estimated";
    @SerializedName(SERIALIZED_NAME_ESTIMATED)
    private boolean estimated;

    public static final String SERIALIZED_NAME_REGISTRATION_NUMBER = "registration_number";
    @SerializedName(SERIALIZED_NAME_REGISTRATION_NUMBER)
    private String registrationNumber;

    public CfarTax() {
    }

    public CfarTax name(String name) {
        this.name = name;
        return this;
    }

    @javax.annotation.Nonnull
    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public CfarTax rate(String rate) {
        this.rate = rate;
        return this;
    }

    @javax.annotation.Nonnull
    public String getRate() {
        return rate;
    }

    public void setRate(String rate) {
        this.rate = rate;
    }

    public CfarTax amount(String amount) {
        this.amount = amount;
        return this;
    }

    @javax.annotation.Nonnull
    public String getAmount() {
        return amount;
    }

    public void setAmount(String amount) {
        this.amount = amount;
    }

    public CfarTax registrationNumber(String registrationNumber) {

        this.registrationNumber = registrationNumber;
        return this;
    }

    /**
     * The number of the registration
     *
     * @return registrationNumber
     **/
    public String getRegistrationNumber() {
        return registrationNumber;
    }


    public void setRegistrationNumber(String registrationNumber) {
        this.registrationNumber = registrationNumber;
    }

    public boolean isEstimated() {
        return estimated;
    }

    public void setEstimated(boolean estimated) {
        this.estimated = estimated;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) {
            return true;
        }
        if (o == null || getClass() != o.getClass()) {
            return false;
        }
        CfarTax cfarTax = (CfarTax) o;
        return Objects.equals(this.name, cfarTax.name) &&
                Objects.equals(this.amount, cfarTax.amount) &&
                Objects.equals(this.rate, cfarTax.rate) &&
                Objects.equals(this.registrationNumber, cfarTax.registrationNumber) &&
                Objects.equals(this.estimated, cfarTax.estimated);
    }

    @Override
    public int hashCode() {
        return Objects.hash(name, amount, rate, registrationNumber, estimated);
    }

    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append("class CfarTax {\n");
        sb.append("    name: ").append(toIndentedString(name)).append("\n");
        sb.append("    amount: ").append(toIndentedString(amount)).append("\n");
        sb.append("    rate: ").append(toIndentedString(rate)).append("\n");
        sb.append("    registrationNumber: ").append(toIndentedString(registrationNumber)).append("\n");
        sb.append("    estimated: ").append(toIndentedString(estimated)).append("\n");
        sb.append("}");
        return sb.toString();
    }

    /**
     * Convert the given object to string with each line indented by 4 spaces
     * (except the first line).
     */
    private String toIndentedString(Object o) {
        if (o == null) {
            return "null";
        }
        return o.toString().replace("\n", "\n    ");
    }

    public static class CustomTypeAdapterFactory implements TypeAdapterFactory {
        @SuppressWarnings("unchecked")
        @Override
        public  TypeAdapter create(Gson gson, TypeToken type) {
            if (!CfarTax.class.isAssignableFrom(type.getRawType())) {
                return null; // this class only serializes 'CfarTax' and its subtypes
            }
            final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class);
            final TypeAdapter thisAdapter
                    = gson.getDelegateAdapter(this, TypeToken.get(CfarTax.class));

            return (TypeAdapter) new TypeAdapter() {
                @Override
                public void write(JsonWriter out, CfarTax value) throws IOException {
                    JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject();
                    elementAdapter.write(out, obj);
                }

                @Override
                public CfarTax read(JsonReader in) throws IOException {
                    JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject();
                    return thisAdapter.fromJsonTree(jsonObj);
                }

            }.nullSafe();
        }
    }

    /**
     * Create an instance of CfarTax given an JSON string
     *
     * @param jsonString JSON string
     * @return An instance of CfarTax
     * @throws IOException if the JSON string is invalid with respect to CfarTax
     */
    public static CfarTax fromJson(String jsonString) throws IOException {
        return JSON.getGson().fromJson(jsonString, CfarTax.class);
    }

    /**
     * Convert an instance of CfarTax to an JSON string
     *
     * @return JSON string
     */
    public String toJson() {
        return JSON.getGson().toJson(this);
    }
}





© 2015 - 2024 Weber Informatics LLC | Privacy Policy