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

io.sphere.client.shop.model.TaxCategory Maven / Gradle / Ivy

There is a newer version: 0.72.1
Show newest version
package io.sphere.client.shop.model;

import java.util.ArrayList;
import java.util.List;
import javax.annotation.Nonnull;
import io.sphere.client.model.ReferenceId;
import io.sphere.client.model.VersionedId;

public class TaxCategory {
    private static final String typeId = "tax-category";
    @Nonnull private String id;
    private int version;
    @Nonnull private String name;
    @Nonnull private String description = "";
    @Nonnull private List rates = new ArrayList();

    // for JSON deserializer
    protected TaxCategory() {}

    private TaxCategory(final String id, final int version, final String name, final String description, final List rates) {
        this.id = id;
        this.version = version;
        this.name = name;
        this.description = description;
        this.rates = rates;
    }

    public static TaxCategory create(final String id, final int version, final String name, final String description, final List rates) {
        return new TaxCategory(id, version, name, description, rates);
    }

    /** The unique id. */
    @Nonnull public String getId() { return id; }

    /** The {@link #getId() id} plus version. */
    @Nonnull public VersionedId getIdAndVersion() { return VersionedId.create(id, version); }

    /** The name of the tax category. */
    @Nonnull public String getName() { return name; }

    /** The description of the tax category. */
    @Nonnull public String getDescription() { return description; }

    /** The tax rates. */
    @Nonnull public List getRates() { return rates; }

    /** The ReferenceId for this tax category. */
    @Nonnull public ReferenceId getReferenceId() { return reference(id); }


    @Override
    public String toString() {
        return "TaxCategory{" +
                "id='" + id + '\'' +
                ", version=" + version +
                ", name='" + name + '\'' +
                ", description='" + description + '\'' +
                ", rates=" + rates +
                '}';
    }

    public static ReferenceId reference(String id) {
        return ReferenceId.create(typeId, id);
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy