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

com.spotinst.sdkjava.model.SpectrumMetricDimension Maven / Gradle / Ivy

There is a newer version: 1.0.121
Show newest version
package com.spotinst.sdkjava.model;

import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;

import java.util.HashSet;
import java.util.Objects;
import java.util.Set;

/**
 * Created by aharontwizer on 8/27/15.
 */
@JsonIgnoreProperties(ignoreUnknown = true)
public class SpectrumMetricDimension {

    // Partial Update support
    @JsonIgnore
    private Set isSet;
    private String name;
    private String value;

    //region Constructor

    private SpectrumMetricDimension() {
        isSet = new HashSet<>();
    }
    //endregion


    public Set getIsSet() {
        return isSet;
    }

    public void setIsSet(Set isSet) {
        this.isSet = isSet;
    }

    public String getName() {
        return name;
    }

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

    public String getValue() {
        return value;
    }

    private void setValue(String value) {
        isSet.add("value");
        this.value = value;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        SpectrumMetricDimension that = (SpectrumMetricDimension) o;

        if (!name.equals(that.name)) return false;
        return !(!Objects.equals(value, that.value));

    }

    @Override
    public int hashCode() {
        int result = name.hashCode();
        result = 31 * result + (value != null ? value.hashCode() : 0);
        return result;
    }
    //region Builder class
    public static class Builder {
        private SpectrumMetricDimension dimension;

        private Builder() {
            this.dimension = new SpectrumMetricDimension();
        }

        public static Builder get(){
            return new Builder();
        }

        public Builder setName(final String name) {
            dimension.setName(name);
            return this;
        }

        public Builder setValue(final String value) {
            dimension.setValue(value);
            return this;
        }

        public SpectrumMetricDimension build() {
            // TODO : Validations
            return dimension;
        }
    }
//endregion

    //region isSet methods
    // Is name Set boolean method
    @JsonIgnore
    public boolean isNameSet() {
        return isSet.contains("name");
    }

    // Is value Set boolean method
    @JsonIgnore
    public boolean isValueSet() {
        return isSet.contains("value");
    }

    //endregion
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy