com.amazonaws.services.quicksight.model.DataPathSort Maven / Gradle / Ivy
/*
* 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.quicksight.model;
import java.io.Serializable;
import javax.annotation.Generated;
import com.amazonaws.protocol.StructuredPojo;
import com.amazonaws.protocol.ProtocolMarshaller;
/**
*
* Allows data paths to be sorted by a specific data value.
*
*
* @see AWS API
* Documentation
*/
@Generated("com.amazonaws:aws-java-sdk-code-generator")
public class DataPathSort implements Serializable, Cloneable, StructuredPojo {
/**
*
* Determines the sort direction.
*
*/
private String direction;
/**
*
* The list of data paths that need to be sorted.
*
*/
private java.util.List sortPaths;
/**
*
* Determines the sort direction.
*
*
* @param direction
* Determines the sort direction.
* @see SortDirection
*/
public void setDirection(String direction) {
this.direction = direction;
}
/**
*
* Determines the sort direction.
*
*
* @return Determines the sort direction.
* @see SortDirection
*/
public String getDirection() {
return this.direction;
}
/**
*
* Determines the sort direction.
*
*
* @param direction
* Determines the sort direction.
* @return Returns a reference to this object so that method calls can be chained together.
* @see SortDirection
*/
public DataPathSort withDirection(String direction) {
setDirection(direction);
return this;
}
/**
*
* Determines the sort direction.
*
*
* @param direction
* Determines the sort direction.
* @return Returns a reference to this object so that method calls can be chained together.
* @see SortDirection
*/
public DataPathSort withDirection(SortDirection direction) {
this.direction = direction.toString();
return this;
}
/**
*
* The list of data paths that need to be sorted.
*
*
* @return The list of data paths that need to be sorted.
*/
public java.util.List getSortPaths() {
return sortPaths;
}
/**
*
* The list of data paths that need to be sorted.
*
*
* @param sortPaths
* The list of data paths that need to be sorted.
*/
public void setSortPaths(java.util.Collection sortPaths) {
if (sortPaths == null) {
this.sortPaths = null;
return;
}
this.sortPaths = new java.util.ArrayList(sortPaths);
}
/**
*
* The list of data paths that need to be sorted.
*
*
* NOTE: This method appends the values to the existing list (if any). Use
* {@link #setSortPaths(java.util.Collection)} or {@link #withSortPaths(java.util.Collection)} if you want to
* override the existing values.
*
*
* @param sortPaths
* The list of data paths that need to be sorted.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public DataPathSort withSortPaths(DataPathValue... sortPaths) {
if (this.sortPaths == null) {
setSortPaths(new java.util.ArrayList(sortPaths.length));
}
for (DataPathValue ele : sortPaths) {
this.sortPaths.add(ele);
}
return this;
}
/**
*
* The list of data paths that need to be sorted.
*
*
* @param sortPaths
* The list of data paths that need to be sorted.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public DataPathSort withSortPaths(java.util.Collection sortPaths) {
setSortPaths(sortPaths);
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 (getDirection() != null)
sb.append("Direction: ").append(getDirection()).append(",");
if (getSortPaths() != null)
sb.append("SortPaths: ").append(getSortPaths());
sb.append("}");
return sb.toString();
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (obj instanceof DataPathSort == false)
return false;
DataPathSort other = (DataPathSort) obj;
if (other.getDirection() == null ^ this.getDirection() == null)
return false;
if (other.getDirection() != null && other.getDirection().equals(this.getDirection()) == false)
return false;
if (other.getSortPaths() == null ^ this.getSortPaths() == null)
return false;
if (other.getSortPaths() != null && other.getSortPaths().equals(this.getSortPaths()) == false)
return false;
return true;
}
@Override
public int hashCode() {
final int prime = 31;
int hashCode = 1;
hashCode = prime * hashCode + ((getDirection() == null) ? 0 : getDirection().hashCode());
hashCode = prime * hashCode + ((getSortPaths() == null) ? 0 : getSortPaths().hashCode());
return hashCode;
}
@Override
public DataPathSort clone() {
try {
return (DataPathSort) 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.quicksight.model.transform.DataPathSortMarshaller.getInstance().marshall(this, protocolMarshaller);
}
}