com.amazonaws.services.elasticloadbalancing.model.Policies Maven / Gradle / Ivy
/*
* Copyright 2010-2016 Amazon.com, Inc. or its affiliates. All Rights
* Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
package com.amazonaws.services.elasticloadbalancing.model;
import java.io.Serializable;
/**
*
* The policies for a load balancer.
*
*/
public class Policies implements Serializable, Cloneable {
/**
*
* The stickiness policies created using
* CreateAppCookieStickinessPolicy.
*
*/
private com.amazonaws.internal.SdkInternalList appCookieStickinessPolicies;
/**
*
* The stickiness policies created using
* CreateLBCookieStickinessPolicy.
*
*/
private com.amazonaws.internal.SdkInternalList lBCookieStickinessPolicies;
/**
*
* The policies other than the stickiness policies.
*
*/
private com.amazonaws.internal.SdkInternalList otherPolicies;
/**
*
* The stickiness policies created using
* CreateAppCookieStickinessPolicy.
*
*
* @return The stickiness policies created using
* CreateAppCookieStickinessPolicy.
*/
public java.util.List getAppCookieStickinessPolicies() {
if (appCookieStickinessPolicies == null) {
appCookieStickinessPolicies = new com.amazonaws.internal.SdkInternalList();
}
return appCookieStickinessPolicies;
}
/**
*
* The stickiness policies created using
* CreateAppCookieStickinessPolicy.
*
*
* @param appCookieStickinessPolicies
* The stickiness policies created using
* CreateAppCookieStickinessPolicy.
*/
public void setAppCookieStickinessPolicies(
java.util.Collection appCookieStickinessPolicies) {
if (appCookieStickinessPolicies == null) {
this.appCookieStickinessPolicies = null;
return;
}
this.appCookieStickinessPolicies = new com.amazonaws.internal.SdkInternalList(
appCookieStickinessPolicies);
}
/**
*
* The stickiness policies created using
* CreateAppCookieStickinessPolicy.
*
*
* NOTE: This method appends the values to the existing list (if
* any). Use {@link #setAppCookieStickinessPolicies(java.util.Collection)}
* or {@link #withAppCookieStickinessPolicies(java.util.Collection)} if you
* want to override the existing values.
*
*
* @param appCookieStickinessPolicies
* The stickiness policies created using
* CreateAppCookieStickinessPolicy.
* @return Returns a reference to this object so that method calls can be
* chained together.
*/
public Policies withAppCookieStickinessPolicies(
AppCookieStickinessPolicy... appCookieStickinessPolicies) {
if (this.appCookieStickinessPolicies == null) {
setAppCookieStickinessPolicies(new com.amazonaws.internal.SdkInternalList(
appCookieStickinessPolicies.length));
}
for (AppCookieStickinessPolicy ele : appCookieStickinessPolicies) {
this.appCookieStickinessPolicies.add(ele);
}
return this;
}
/**
*
* The stickiness policies created using
* CreateAppCookieStickinessPolicy.
*
*
* @param appCookieStickinessPolicies
* The stickiness policies created using
* CreateAppCookieStickinessPolicy.
* @return Returns a reference to this object so that method calls can be
* chained together.
*/
public Policies withAppCookieStickinessPolicies(
java.util.Collection appCookieStickinessPolicies) {
setAppCookieStickinessPolicies(appCookieStickinessPolicies);
return this;
}
/**
*
* The stickiness policies created using
* CreateLBCookieStickinessPolicy.
*
*
* @return The stickiness policies created using
* CreateLBCookieStickinessPolicy.
*/
public java.util.List getLBCookieStickinessPolicies() {
if (lBCookieStickinessPolicies == null) {
lBCookieStickinessPolicies = new com.amazonaws.internal.SdkInternalList();
}
return lBCookieStickinessPolicies;
}
/**
*
* The stickiness policies created using
* CreateLBCookieStickinessPolicy.
*
*
* @param lBCookieStickinessPolicies
* The stickiness policies created using
* CreateLBCookieStickinessPolicy.
*/
public void setLBCookieStickinessPolicies(
java.util.Collection lBCookieStickinessPolicies) {
if (lBCookieStickinessPolicies == null) {
this.lBCookieStickinessPolicies = null;
return;
}
this.lBCookieStickinessPolicies = new com.amazonaws.internal.SdkInternalList(
lBCookieStickinessPolicies);
}
/**
*
* The stickiness policies created using
* CreateLBCookieStickinessPolicy.
*
*
* NOTE: This method appends the values to the existing list (if
* any). Use {@link #setLBCookieStickinessPolicies(java.util.Collection)} or
* {@link #withLBCookieStickinessPolicies(java.util.Collection)} if you want
* to override the existing values.
*
*
* @param lBCookieStickinessPolicies
* The stickiness policies created using
* CreateLBCookieStickinessPolicy.
* @return Returns a reference to this object so that method calls can be
* chained together.
*/
public Policies withLBCookieStickinessPolicies(
LBCookieStickinessPolicy... lBCookieStickinessPolicies) {
if (this.lBCookieStickinessPolicies == null) {
setLBCookieStickinessPolicies(new com.amazonaws.internal.SdkInternalList(
lBCookieStickinessPolicies.length));
}
for (LBCookieStickinessPolicy ele : lBCookieStickinessPolicies) {
this.lBCookieStickinessPolicies.add(ele);
}
return this;
}
/**
*
* The stickiness policies created using
* CreateLBCookieStickinessPolicy.
*
*
* @param lBCookieStickinessPolicies
* The stickiness policies created using
* CreateLBCookieStickinessPolicy.
* @return Returns a reference to this object so that method calls can be
* chained together.
*/
public Policies withLBCookieStickinessPolicies(
java.util.Collection lBCookieStickinessPolicies) {
setLBCookieStickinessPolicies(lBCookieStickinessPolicies);
return this;
}
/**
*
* The policies other than the stickiness policies.
*
*
* @return The policies other than the stickiness policies.
*/
public java.util.List getOtherPolicies() {
if (otherPolicies == null) {
otherPolicies = new com.amazonaws.internal.SdkInternalList();
}
return otherPolicies;
}
/**
*
* The policies other than the stickiness policies.
*
*
* @param otherPolicies
* The policies other than the stickiness policies.
*/
public void setOtherPolicies(java.util.Collection otherPolicies) {
if (otherPolicies == null) {
this.otherPolicies = null;
return;
}
this.otherPolicies = new com.amazonaws.internal.SdkInternalList(
otherPolicies);
}
/**
*
* The policies other than the stickiness policies.
*
*
* NOTE: This method appends the values to the existing list (if
* any). Use {@link #setOtherPolicies(java.util.Collection)} or
* {@link #withOtherPolicies(java.util.Collection)} if you want to override
* the existing values.
*
*
* @param otherPolicies
* The policies other than the stickiness policies.
* @return Returns a reference to this object so that method calls can be
* chained together.
*/
public Policies withOtherPolicies(String... otherPolicies) {
if (this.otherPolicies == null) {
setOtherPolicies(new com.amazonaws.internal.SdkInternalList(
otherPolicies.length));
}
for (String ele : otherPolicies) {
this.otherPolicies.add(ele);
}
return this;
}
/**
*
* The policies other than the stickiness policies.
*
*
* @param otherPolicies
* The policies other than the stickiness policies.
* @return Returns a reference to this object so that method calls can be
* chained together.
*/
public Policies withOtherPolicies(java.util.Collection otherPolicies) {
setOtherPolicies(otherPolicies);
return this;
}
/**
* Returns a string representation of this object; useful for testing and
* debugging.
*
* @return A string representation of this object.
*
* @see java.lang.Object#toString()
*/
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("{");
if (getAppCookieStickinessPolicies() != null)
sb.append("AppCookieStickinessPolicies: "
+ getAppCookieStickinessPolicies() + ",");
if (getLBCookieStickinessPolicies() != null)
sb.append("LBCookieStickinessPolicies: "
+ getLBCookieStickinessPolicies() + ",");
if (getOtherPolicies() != null)
sb.append("OtherPolicies: " + getOtherPolicies());
sb.append("}");
return sb.toString();
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (obj instanceof Policies == false)
return false;
Policies other = (Policies) obj;
if (other.getAppCookieStickinessPolicies() == null
^ this.getAppCookieStickinessPolicies() == null)
return false;
if (other.getAppCookieStickinessPolicies() != null
&& other.getAppCookieStickinessPolicies().equals(
this.getAppCookieStickinessPolicies()) == false)
return false;
if (other.getLBCookieStickinessPolicies() == null
^ this.getLBCookieStickinessPolicies() == null)
return false;
if (other.getLBCookieStickinessPolicies() != null
&& other.getLBCookieStickinessPolicies().equals(
this.getLBCookieStickinessPolicies()) == false)
return false;
if (other.getOtherPolicies() == null ^ this.getOtherPolicies() == null)
return false;
if (other.getOtherPolicies() != null
&& other.getOtherPolicies().equals(this.getOtherPolicies()) == false)
return false;
return true;
}
@Override
public int hashCode() {
final int prime = 31;
int hashCode = 1;
hashCode = prime
* hashCode
+ ((getAppCookieStickinessPolicies() == null) ? 0
: getAppCookieStickinessPolicies().hashCode());
hashCode = prime
* hashCode
+ ((getLBCookieStickinessPolicies() == null) ? 0
: getLBCookieStickinessPolicies().hashCode());
hashCode = prime
* hashCode
+ ((getOtherPolicies() == null) ? 0 : getOtherPolicies()
.hashCode());
return hashCode;
}
@Override
public Policies clone() {
try {
return (Policies) super.clone();
} catch (CloneNotSupportedException e) {
throw new IllegalStateException(
"Got a CloneNotSupportedException from Object.clone() "
+ "even though we're Cloneable!", e);
}
}
}