com.criteo.marketing.model.ThrottlePolicy Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of marketing.java-client Show documentation
Show all versions of marketing.java-client Show documentation
Criteo Marketing SDK for Java
/*
* Marketing API v.1.0
* IMPORTANT: This swagger links to Criteo production environment. Any test applied here will thus impact real campaigns.
*
* OpenAPI spec version: v.1.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.criteo.marketing.model;
import java.util.Objects;
import java.util.Arrays;
import com.criteo.marketing.model.ThrottlePolicyRates;
import com.google.gson.TypeAdapter;
import com.google.gson.annotations.JsonAdapter;
import com.google.gson.annotations.SerializedName;
import com.google.gson.stream.JsonReader;
import com.google.gson.stream.JsonWriter;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.io.IOException;
/**
* ThrottlePolicy
*/
public class ThrottlePolicy {
/**
* Gets or Sets policyType
*/
@JsonAdapter(PolicyTypeEnum.Adapter.class)
public enum PolicyTypeEnum {
IPTHROTTLING("IpThrottling"),
CLIENTTHROTTLING("ClientThrottling");
private String value;
PolicyTypeEnum(String value) {
this.value = value;
}
public String getValue() {
return value;
}
@Override
public String toString() {
return String.valueOf(value);
}
public static PolicyTypeEnum fromValue(String text) {
for (PolicyTypeEnum b : PolicyTypeEnum.values()) {
if (String.valueOf(b.value).equals(text)) {
return b;
}
}
throw new IllegalArgumentException("Unexpected value '" + text + "'");
}
public static class Adapter extends TypeAdapter {
@Override
public void write(final JsonWriter jsonWriter, final PolicyTypeEnum enumeration) throws IOException {
jsonWriter.value(enumeration.getValue());
}
@Override
public PolicyTypeEnum read(final JsonReader jsonReader) throws IOException {
String value = jsonReader.nextString();
return PolicyTypeEnum.fromValue(String.valueOf(value));
}
}
}
public static final String SERIALIZED_NAME_POLICY_TYPE = "policyType";
@SerializedName(SERIALIZED_NAME_POLICY_TYPE)
private PolicyTypeEnum policyType;
public static final String SERIALIZED_NAME_RATES = "rates";
@SerializedName(SERIALIZED_NAME_RATES)
private ThrottlePolicyRates rates = null;
/**
* Get policyType
* @return policyType
**/
@ApiModelProperty(value = "")
public PolicyTypeEnum getPolicyType() {
return policyType;
}
public ThrottlePolicy rates(ThrottlePolicyRates rates) {
this.rates = rates;
return this;
}
/**
* Get rates
* @return rates
**/
@ApiModelProperty(value = "")
public ThrottlePolicyRates getRates() {
return rates;
}
public void setRates(ThrottlePolicyRates rates) {
this.rates = rates;
}
@Override
public boolean equals(java.lang.Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
ThrottlePolicy throttlePolicy = (ThrottlePolicy) o;
return Objects.equals(this.policyType, throttlePolicy.policyType) &&
Objects.equals(this.rates, throttlePolicy.rates);
}
@Override
public int hashCode() {
return Objects.hash(policyType, rates);
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class ThrottlePolicy {\n");
sb.append(" policyType: ").append(toIndentedString(policyType)).append("\n");
sb.append(" rates: ").append(toIndentedString(rates)).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(java.lang.Object o) {
if (o == null) {
return "null";
}
return o.toString().replace("\n", "\n ");
}
}