
com.amazonaws.services.devicefarm.model.Rule Maven / Gradle / Ivy
Show all versions of aws-java-sdk-devicefarm Show documentation
/*
* 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.devicefarm.model;
import java.io.Serializable;
/**
*
* Represents a condition for a device pool.
*
*/
public class Rule implements Serializable, Cloneable {
/**
*
* The rule's stringified attribute. For example, specify the value as
* "\"abc\""
.
*
*
* Allowed values include:
*
*
* -
*
* ARN: The ARN.
*
*
* -
*
* FORM_FACTOR: The form factor (for example, phone or tablet).
*
*
* -
*
* MANUFACTURER: The manufacturer.
*
*
* -
*
* PLATFORM: The platform (for example, Android or iOS).
*
*
*
*/
private String attribute;
/**
*
* The rule's operator.
*
*
* -
*
* EQUALS: The equals operator.
*
*
* -
*
* GREATER_THAN: The greater-than operator.
*
*
* -
*
* IN: The in operator.
*
*
* -
*
* LESS_THAN: The less-than operator.
*
*
* -
*
* NOT_IN: The not-in operator.
*
*
*
*/
private String operator;
/**
*
* The rule's value.
*
*/
private String value;
/**
*
* The rule's stringified attribute. For example, specify the value as
* "\"abc\""
.
*
*
* Allowed values include:
*
*
* -
*
* ARN: The ARN.
*
*
* -
*
* FORM_FACTOR: The form factor (for example, phone or tablet).
*
*
* -
*
* MANUFACTURER: The manufacturer.
*
*
* -
*
* PLATFORM: The platform (for example, Android or iOS).
*
*
*
*
* @param attribute
* The rule's stringified attribute. For example, specify the value
* as "\"abc\""
.
*
* Allowed values include:
*
*
* -
*
* ARN: The ARN.
*
*
* -
*
* FORM_FACTOR: The form factor (for example, phone or tablet).
*
*
* -
*
* MANUFACTURER: The manufacturer.
*
*
* -
*
* PLATFORM: The platform (for example, Android or iOS).
*
*
* @see DeviceAttribute
*/
public void setAttribute(String attribute) {
this.attribute = attribute;
}
/**
*
* The rule's stringified attribute. For example, specify the value as
* "\"abc\""
.
*
*
* Allowed values include:
*
*
* -
*
* ARN: The ARN.
*
*
* -
*
* FORM_FACTOR: The form factor (for example, phone or tablet).
*
*
* -
*
* MANUFACTURER: The manufacturer.
*
*
* -
*
* PLATFORM: The platform (for example, Android or iOS).
*
*
*
*
* @return The rule's stringified attribute. For example, specify the value
* as "\"abc\""
.
*
* Allowed values include:
*
*
* -
*
* ARN: The ARN.
*
*
* -
*
* FORM_FACTOR: The form factor (for example, phone or tablet).
*
*
* -
*
* MANUFACTURER: The manufacturer.
*
*
* -
*
* PLATFORM: The platform (for example, Android or iOS).
*
*
* @see DeviceAttribute
*/
public String getAttribute() {
return this.attribute;
}
/**
*
* The rule's stringified attribute. For example, specify the value as
* "\"abc\""
.
*
*
* Allowed values include:
*
*
* -
*
* ARN: The ARN.
*
*
* -
*
* FORM_FACTOR: The form factor (for example, phone or tablet).
*
*
* -
*
* MANUFACTURER: The manufacturer.
*
*
* -
*
* PLATFORM: The platform (for example, Android or iOS).
*
*
*
*
* @param attribute
* The rule's stringified attribute. For example, specify the value
* as "\"abc\""
.
*
* Allowed values include:
*
*
* -
*
* ARN: The ARN.
*
*
* -
*
* FORM_FACTOR: The form factor (for example, phone or tablet).
*
*
* -
*
* MANUFACTURER: The manufacturer.
*
*
* -
*
* PLATFORM: The platform (for example, Android or iOS).
*
*
* @return Returns a reference to this object so that method calls can be
* chained together.
* @see DeviceAttribute
*/
public Rule withAttribute(String attribute) {
setAttribute(attribute);
return this;
}
/**
*
* The rule's stringified attribute. For example, specify the value as
* "\"abc\""
.
*
*
* Allowed values include:
*
*
* -
*
* ARN: The ARN.
*
*
* -
*
* FORM_FACTOR: The form factor (for example, phone or tablet).
*
*
* -
*
* MANUFACTURER: The manufacturer.
*
*
* -
*
* PLATFORM: The platform (for example, Android or iOS).
*
*
*
*
* @param attribute
* The rule's stringified attribute. For example, specify the value
* as "\"abc\""
.
*
* Allowed values include:
*
*
* -
*
* ARN: The ARN.
*
*
* -
*
* FORM_FACTOR: The form factor (for example, phone or tablet).
*
*
* -
*
* MANUFACTURER: The manufacturer.
*
*
* -
*
* PLATFORM: The platform (for example, Android or iOS).
*
*
* @see DeviceAttribute
*/
public void setAttribute(DeviceAttribute attribute) {
this.attribute = attribute.toString();
}
/**
*
* The rule's stringified attribute. For example, specify the value as
* "\"abc\""
.
*
*
* Allowed values include:
*
*
* -
*
* ARN: The ARN.
*
*
* -
*
* FORM_FACTOR: The form factor (for example, phone or tablet).
*
*
* -
*
* MANUFACTURER: The manufacturer.
*
*
* -
*
* PLATFORM: The platform (for example, Android or iOS).
*
*
*
*
* @param attribute
* The rule's stringified attribute. For example, specify the value
* as "\"abc\""
.
*
* Allowed values include:
*
*
* -
*
* ARN: The ARN.
*
*
* -
*
* FORM_FACTOR: The form factor (for example, phone or tablet).
*
*
* -
*
* MANUFACTURER: The manufacturer.
*
*
* -
*
* PLATFORM: The platform (for example, Android or iOS).
*
*
* @return Returns a reference to this object so that method calls can be
* chained together.
* @see DeviceAttribute
*/
public Rule withAttribute(DeviceAttribute attribute) {
setAttribute(attribute);
return this;
}
/**
*
* The rule's operator.
*
*
* -
*
* EQUALS: The equals operator.
*
*
* -
*
* GREATER_THAN: The greater-than operator.
*
*
* -
*
* IN: The in operator.
*
*
* -
*
* LESS_THAN: The less-than operator.
*
*
* -
*
* NOT_IN: The not-in operator.
*
*
*
*
* @param operator
* The rule's operator.
*
* -
*
* EQUALS: The equals operator.
*
*
* -
*
* GREATER_THAN: The greater-than operator.
*
*
* -
*
* IN: The in operator.
*
*
* -
*
* LESS_THAN: The less-than operator.
*
*
* -
*
* NOT_IN: The not-in operator.
*
*
* @see RuleOperator
*/
public void setOperator(String operator) {
this.operator = operator;
}
/**
*
* The rule's operator.
*
*
* -
*
* EQUALS: The equals operator.
*
*
* -
*
* GREATER_THAN: The greater-than operator.
*
*
* -
*
* IN: The in operator.
*
*
* -
*
* LESS_THAN: The less-than operator.
*
*
* -
*
* NOT_IN: The not-in operator.
*
*
*
*
* @return The rule's operator.
*
* -
*
* EQUALS: The equals operator.
*
*
* -
*
* GREATER_THAN: The greater-than operator.
*
*
* -
*
* IN: The in operator.
*
*
* -
*
* LESS_THAN: The less-than operator.
*
*
* -
*
* NOT_IN: The not-in operator.
*
*
* @see RuleOperator
*/
public String getOperator() {
return this.operator;
}
/**
*
* The rule's operator.
*
*
* -
*
* EQUALS: The equals operator.
*
*
* -
*
* GREATER_THAN: The greater-than operator.
*
*
* -
*
* IN: The in operator.
*
*
* -
*
* LESS_THAN: The less-than operator.
*
*
* -
*
* NOT_IN: The not-in operator.
*
*
*
*
* @param operator
* The rule's operator.
*
* -
*
* EQUALS: The equals operator.
*
*
* -
*
* GREATER_THAN: The greater-than operator.
*
*
* -
*
* IN: The in operator.
*
*
* -
*
* LESS_THAN: The less-than operator.
*
*
* -
*
* NOT_IN: The not-in operator.
*
*
* @return Returns a reference to this object so that method calls can be
* chained together.
* @see RuleOperator
*/
public Rule withOperator(String operator) {
setOperator(operator);
return this;
}
/**
*
* The rule's operator.
*
*
* -
*
* EQUALS: The equals operator.
*
*
* -
*
* GREATER_THAN: The greater-than operator.
*
*
* -
*
* IN: The in operator.
*
*
* -
*
* LESS_THAN: The less-than operator.
*
*
* -
*
* NOT_IN: The not-in operator.
*
*
*
*
* @param operator
* The rule's operator.
*
* -
*
* EQUALS: The equals operator.
*
*
* -
*
* GREATER_THAN: The greater-than operator.
*
*
* -
*
* IN: The in operator.
*
*
* -
*
* LESS_THAN: The less-than operator.
*
*
* -
*
* NOT_IN: The not-in operator.
*
*
* @see RuleOperator
*/
public void setOperator(RuleOperator operator) {
this.operator = operator.toString();
}
/**
*
* The rule's operator.
*
*
* -
*
* EQUALS: The equals operator.
*
*
* -
*
* GREATER_THAN: The greater-than operator.
*
*
* -
*
* IN: The in operator.
*
*
* -
*
* LESS_THAN: The less-than operator.
*
*
* -
*
* NOT_IN: The not-in operator.
*
*
*
*
* @param operator
* The rule's operator.
*
* -
*
* EQUALS: The equals operator.
*
*
* -
*
* GREATER_THAN: The greater-than operator.
*
*
* -
*
* IN: The in operator.
*
*
* -
*
* LESS_THAN: The less-than operator.
*
*
* -
*
* NOT_IN: The not-in operator.
*
*
* @return Returns a reference to this object so that method calls can be
* chained together.
* @see RuleOperator
*/
public Rule withOperator(RuleOperator operator) {
setOperator(operator);
return this;
}
/**
*
* The rule's value.
*
*
* @param value
* The rule's value.
*/
public void setValue(String value) {
this.value = value;
}
/**
*
* The rule's value.
*
*
* @return The rule's value.
*/
public String getValue() {
return this.value;
}
/**
*
* The rule's value.
*
*
* @param value
* The rule's value.
* @return Returns a reference to this object so that method calls can be
* chained together.
*/
public Rule withValue(String value) {
setValue(value);
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 (getAttribute() != null)
sb.append("Attribute: " + getAttribute() + ",");
if (getOperator() != null)
sb.append("Operator: " + getOperator() + ",");
if (getValue() != null)
sb.append("Value: " + getValue());
sb.append("}");
return sb.toString();
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (obj instanceof Rule == false)
return false;
Rule other = (Rule) obj;
if (other.getAttribute() == null ^ this.getAttribute() == null)
return false;
if (other.getAttribute() != null
&& other.getAttribute().equals(this.getAttribute()) == false)
return false;
if (other.getOperator() == null ^ this.getOperator() == null)
return false;
if (other.getOperator() != null
&& other.getOperator().equals(this.getOperator()) == false)
return false;
if (other.getValue() == null ^ this.getValue() == null)
return false;
if (other.getValue() != null
&& other.getValue().equals(this.getValue()) == false)
return false;
return true;
}
@Override
public int hashCode() {
final int prime = 31;
int hashCode = 1;
hashCode = prime * hashCode
+ ((getAttribute() == null) ? 0 : getAttribute().hashCode());
hashCode = prime * hashCode
+ ((getOperator() == null) ? 0 : getOperator().hashCode());
hashCode = prime * hashCode
+ ((getValue() == null) ? 0 : getValue().hashCode());
return hashCode;
}
@Override
public Rule clone() {
try {
return (Rule) super.clone();
} catch (CloneNotSupportedException e) {
throw new IllegalStateException(
"Got a CloneNotSupportedException from Object.clone() "
+ "even though we're Cloneable!", e);
}
}
}