com.amazonaws.services.sagemaker.model.SearchExpression Maven / Gradle / Ivy
Show all versions of aws-java-sdk-sagemaker Show documentation
/*
* Copyright 2019-2024 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.sagemaker.model;
import java.io.Serializable;
import javax.annotation.Generated;
import com.amazonaws.protocol.StructuredPojo;
import com.amazonaws.protocol.ProtocolMarshaller;
/**
*
* A multi-expression that searches for the specified resource or resources in a search. All resource objects that
* satisfy the expression's condition are included in the search results. You must specify at least one subexpression,
* filter, or nested filter. A SearchExpression
can contain up to twenty elements.
*
*
* A SearchExpression
contains the following components:
*
*
* -
*
* A list of Filter
objects. Each filter defines a simple Boolean expression comprised of a resource
* property name, Boolean operator, and value.
*
*
* -
*
* A list of NestedFilter
objects. Each nested filter defines a list of Boolean expressions using a list of
* resource properties. A nested filter is satisfied if a single object in the list satisfies all Boolean expressions.
*
*
* -
*
* A list of SearchExpression
objects. A search expression object can be nested in a list of search
* expression objects.
*
*
* -
*
* A Boolean operator: And
or Or
.
*
*
*
*
* @see AWS API
* Documentation
*/
@Generated("com.amazonaws:aws-java-sdk-code-generator")
public class SearchExpression implements Serializable, Cloneable, StructuredPojo {
/**
*
* A list of filter objects.
*
*/
private java.util.List filters;
/**
*
* A list of nested filter objects.
*
*/
private java.util.List nestedFilters;
/**
*
* A list of search expression objects.
*
*/
private java.util.List subExpressions;
/**
*
* A Boolean operator used to evaluate the search expression. If you want every conditional statement in all lists
* to be satisfied for the entire search expression to be true, specify And
. If only a single
* conditional statement needs to be true for the entire search expression to be true, specify Or
. The
* default value is And
.
*
*/
private String operator;
/**
*
* A list of filter objects.
*
*
* @return A list of filter objects.
*/
public java.util.List getFilters() {
return filters;
}
/**
*
* A list of filter objects.
*
*
* @param filters
* A list of filter objects.
*/
public void setFilters(java.util.Collection filters) {
if (filters == null) {
this.filters = null;
return;
}
this.filters = new java.util.ArrayList(filters);
}
/**
*
* A list of filter objects.
*
*
* NOTE: This method appends the values to the existing list (if any). Use
* {@link #setFilters(java.util.Collection)} or {@link #withFilters(java.util.Collection)} if you want to override
* the existing values.
*
*
* @param filters
* A list of filter objects.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public SearchExpression withFilters(Filter... filters) {
if (this.filters == null) {
setFilters(new java.util.ArrayList(filters.length));
}
for (Filter ele : filters) {
this.filters.add(ele);
}
return this;
}
/**
*
* A list of filter objects.
*
*
* @param filters
* A list of filter objects.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public SearchExpression withFilters(java.util.Collection filters) {
setFilters(filters);
return this;
}
/**
*
* A list of nested filter objects.
*
*
* @return A list of nested filter objects.
*/
public java.util.List getNestedFilters() {
return nestedFilters;
}
/**
*
* A list of nested filter objects.
*
*
* @param nestedFilters
* A list of nested filter objects.
*/
public void setNestedFilters(java.util.Collection nestedFilters) {
if (nestedFilters == null) {
this.nestedFilters = null;
return;
}
this.nestedFilters = new java.util.ArrayList(nestedFilters);
}
/**
*
* A list of nested filter objects.
*
*
* NOTE: This method appends the values to the existing list (if any). Use
* {@link #setNestedFilters(java.util.Collection)} or {@link #withNestedFilters(java.util.Collection)} if you want
* to override the existing values.
*
*
* @param nestedFilters
* A list of nested filter objects.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public SearchExpression withNestedFilters(NestedFilters... nestedFilters) {
if (this.nestedFilters == null) {
setNestedFilters(new java.util.ArrayList(nestedFilters.length));
}
for (NestedFilters ele : nestedFilters) {
this.nestedFilters.add(ele);
}
return this;
}
/**
*
* A list of nested filter objects.
*
*
* @param nestedFilters
* A list of nested filter objects.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public SearchExpression withNestedFilters(java.util.Collection nestedFilters) {
setNestedFilters(nestedFilters);
return this;
}
/**
*
* A list of search expression objects.
*
*
* @return A list of search expression objects.
*/
public java.util.List getSubExpressions() {
return subExpressions;
}
/**
*
* A list of search expression objects.
*
*
* @param subExpressions
* A list of search expression objects.
*/
public void setSubExpressions(java.util.Collection subExpressions) {
if (subExpressions == null) {
this.subExpressions = null;
return;
}
this.subExpressions = new java.util.ArrayList(subExpressions);
}
/**
*
* A list of search expression objects.
*
*
* NOTE: This method appends the values to the existing list (if any). Use
* {@link #setSubExpressions(java.util.Collection)} or {@link #withSubExpressions(java.util.Collection)} if you want
* to override the existing values.
*
*
* @param subExpressions
* A list of search expression objects.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public SearchExpression withSubExpressions(SearchExpression... subExpressions) {
if (this.subExpressions == null) {
setSubExpressions(new java.util.ArrayList(subExpressions.length));
}
for (SearchExpression ele : subExpressions) {
this.subExpressions.add(ele);
}
return this;
}
/**
*
* A list of search expression objects.
*
*
* @param subExpressions
* A list of search expression objects.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public SearchExpression withSubExpressions(java.util.Collection subExpressions) {
setSubExpressions(subExpressions);
return this;
}
/**
*
* A Boolean operator used to evaluate the search expression. If you want every conditional statement in all lists
* to be satisfied for the entire search expression to be true, specify And
. If only a single
* conditional statement needs to be true for the entire search expression to be true, specify Or
. The
* default value is And
.
*
*
* @param operator
* A Boolean operator used to evaluate the search expression. If you want every conditional statement in all
* lists to be satisfied for the entire search expression to be true, specify And
. If only a
* single conditional statement needs to be true for the entire search expression to be true, specify
* Or
. The default value is And
.
* @see BooleanOperator
*/
public void setOperator(String operator) {
this.operator = operator;
}
/**
*
* A Boolean operator used to evaluate the search expression. If you want every conditional statement in all lists
* to be satisfied for the entire search expression to be true, specify And
. If only a single
* conditional statement needs to be true for the entire search expression to be true, specify Or
. The
* default value is And
.
*
*
* @return A Boolean operator used to evaluate the search expression. If you want every conditional statement in all
* lists to be satisfied for the entire search expression to be true, specify And
. If only a
* single conditional statement needs to be true for the entire search expression to be true, specify
* Or
. The default value is And
.
* @see BooleanOperator
*/
public String getOperator() {
return this.operator;
}
/**
*
* A Boolean operator used to evaluate the search expression. If you want every conditional statement in all lists
* to be satisfied for the entire search expression to be true, specify And
. If only a single
* conditional statement needs to be true for the entire search expression to be true, specify Or
. The
* default value is And
.
*
*
* @param operator
* A Boolean operator used to evaluate the search expression. If you want every conditional statement in all
* lists to be satisfied for the entire search expression to be true, specify And
. If only a
* single conditional statement needs to be true for the entire search expression to be true, specify
* Or
. The default value is And
.
* @return Returns a reference to this object so that method calls can be chained together.
* @see BooleanOperator
*/
public SearchExpression withOperator(String operator) {
setOperator(operator);
return this;
}
/**
*
* A Boolean operator used to evaluate the search expression. If you want every conditional statement in all lists
* to be satisfied for the entire search expression to be true, specify And
. If only a single
* conditional statement needs to be true for the entire search expression to be true, specify Or
. The
* default value is And
.
*
*
* @param operator
* A Boolean operator used to evaluate the search expression. If you want every conditional statement in all
* lists to be satisfied for the entire search expression to be true, specify And
. If only a
* single conditional statement needs to be true for the entire search expression to be true, specify
* Or
. The default value is And
.
* @return Returns a reference to this object so that method calls can be chained together.
* @see BooleanOperator
*/
public SearchExpression withOperator(BooleanOperator operator) {
this.operator = operator.toString();
return this;
}
/**
* Returns a string representation of this object. This is useful for testing and debugging. Sensitive data will be
* redacted from this string using a placeholder value.
*
* @return A string representation of this object.
*
* @see java.lang.Object#toString()
*/
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("{");
if (getFilters() != null)
sb.append("Filters: ").append(getFilters()).append(",");
if (getNestedFilters() != null)
sb.append("NestedFilters: ").append(getNestedFilters()).append(",");
if (getSubExpressions() != null)
sb.append("SubExpressions: ").append(getSubExpressions()).append(",");
if (getOperator() != null)
sb.append("Operator: ").append(getOperator());
sb.append("}");
return sb.toString();
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (obj instanceof SearchExpression == false)
return false;
SearchExpression other = (SearchExpression) obj;
if (other.getFilters() == null ^ this.getFilters() == null)
return false;
if (other.getFilters() != null && other.getFilters().equals(this.getFilters()) == false)
return false;
if (other.getNestedFilters() == null ^ this.getNestedFilters() == null)
return false;
if (other.getNestedFilters() != null && other.getNestedFilters().equals(this.getNestedFilters()) == false)
return false;
if (other.getSubExpressions() == null ^ this.getSubExpressions() == null)
return false;
if (other.getSubExpressions() != null && other.getSubExpressions().equals(this.getSubExpressions()) == false)
return false;
if (other.getOperator() == null ^ this.getOperator() == null)
return false;
if (other.getOperator() != null && other.getOperator().equals(this.getOperator()) == false)
return false;
return true;
}
@Override
public int hashCode() {
final int prime = 31;
int hashCode = 1;
hashCode = prime * hashCode + ((getFilters() == null) ? 0 : getFilters().hashCode());
hashCode = prime * hashCode + ((getNestedFilters() == null) ? 0 : getNestedFilters().hashCode());
hashCode = prime * hashCode + ((getSubExpressions() == null) ? 0 : getSubExpressions().hashCode());
hashCode = prime * hashCode + ((getOperator() == null) ? 0 : getOperator().hashCode());
return hashCode;
}
@Override
public SearchExpression clone() {
try {
return (SearchExpression) super.clone();
} catch (CloneNotSupportedException e) {
throw new IllegalStateException("Got a CloneNotSupportedException from Object.clone() " + "even though we're Cloneable!", e);
}
}
@com.amazonaws.annotation.SdkInternalApi
@Override
public void marshall(ProtocolMarshaller protocolMarshaller) {
com.amazonaws.services.sagemaker.model.transform.SearchExpressionMarshaller.getInstance().marshall(this, protocolMarshaller);
}
}