/* * Copyright 2018-2023 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.amplifyuibuilder.model; import java.io.Serializable; import javax.annotation.Generated; import com.amazonaws.protocol.StructuredPojo; import com.amazonaws.protocol.ProtocolMarshaller; /** *

* Describes the configuration for binding a component's properties to data. *

* * @see AWS API Documentation */ @Generated("com.amazonaws:aws-java-sdk-code-generator") public class ComponentDataConfiguration implements Serializable, Cloneable, StructuredPojo { /** *

* The name of the data model to use to bind data to a component. *

*/ private String model; /** *

* Describes how to sort the component's properties. *

*/ private java.util.List sort; /** *

* Represents the conditional logic to use when binding data to a component. Use this property to retrieve only a * subset of the data in a collection. *

*/ private Predicate predicate; /** *

* A list of IDs to use to bind data to a component. Use this property to bind specifically chosen data, rather than * data retrieved from a query. *

*/ private java.util.List identifiers; /** *

* The name of the data model to use to bind data to a component. *

* * @param model * The name of the data model to use to bind data to a component. */ public void setModel(String model) { this.model = model; } /** *

* The name of the data model to use to bind data to a component. *

* * @return The name of the data model to use to bind data to a component. */ public String getModel() { return this.model; } /** *

* The name of the data model to use to bind data to a component. *

* * @param model * The name of the data model to use to bind data to a component. * @return Returns a reference to this object so that method calls can be chained together. */ public ComponentDataConfiguration withModel(String model) { setModel(model); return this; } /** *

* Describes how to sort the component's properties. *

* * @return Describes how to sort the component's properties. */ public java.util.List getSort() { return sort; } /** *

* Describes how to sort the component's properties. *

* * @param sort * Describes how to sort the component's properties. */ public void setSort(java.util.Collection sort) { if (sort == null) { this.sort = null; return; } this.sort = new java.util.ArrayList(sort); } /** *

* Describes how to sort the component's properties. *

*

* NOTE: This method appends the values to the existing list (if any). Use * {@link #setSort(java.util.Collection)} or {@link #withSort(java.util.Collection)} if you want to override the * existing values. *

* * @param sort * Describes how to sort the component's properties. * @return Returns a reference to this object so that method calls can be chained together. */ public ComponentDataConfiguration withSort(SortProperty... sort) { if (this.sort == null) { setSort(new java.util.ArrayList(sort.length)); } for (SortProperty ele : sort) { this.sort.add(ele); } return this; } /** *

* Describes how to sort the component's properties. *

* * @param sort * Describes how to sort the component's properties. * @return Returns a reference to this object so that method calls can be chained together. */ public ComponentDataConfiguration withSort(java.util.Collection sort) { setSort(sort); return this; } /** *

* Represents the conditional logic to use when binding data to a component. Use this property to retrieve only a * subset of the data in a collection. *

* * @param predicate * Represents the conditional logic to use when binding data to a component. Use this property to retrieve * only a subset of the data in a collection. */ public void setPredicate(Predicate predicate) { this.predicate = predicate; } /** *

* Represents the conditional logic to use when binding data to a component. Use this property to retrieve only a * subset of the data in a collection. *

* * @return Represents the conditional logic to use when binding data to a component. Use this property to retrieve * only a subset of the data in a collection. */ public Predicate getPredicate() { return this.predicate; } /** *

* Represents the conditional logic to use when binding data to a component. Use this property to retrieve only a * subset of the data in a collection. *

* * @param predicate * Represents the conditional logic to use when binding data to a component. Use this property to retrieve * only a subset of the data in a collection. * @return Returns a reference to this object so that method calls can be chained together. */ public ComponentDataConfiguration withPredicate(Predicate predicate) { setPredicate(predicate); return this; } /** *

* A list of IDs to use to bind data to a component. Use this property to bind specifically chosen data, rather than * data retrieved from a query. *

* * @return A list of IDs to use to bind data to a component. Use this property to bind specifically chosen data, * rather than data retrieved from a query. */ public java.util.List getIdentifiers() { return identifiers; } /** *

* A list of IDs to use to bind data to a component. Use this property to bind specifically chosen data, rather than * data retrieved from a query. *

* * @param identifiers * A list of IDs to use to bind data to a component. Use this property to bind specifically chosen data, * rather than data retrieved from a query. */ public void setIdentifiers(java.util.Collection identifiers) { if (identifiers == null) { this.identifiers = null; return; } this.identifiers = new java.util.ArrayList(identifiers); } /** *

* A list of IDs to use to bind data to a component. Use this property to bind specifically chosen data, rather than * data retrieved from a query. *

*

* NOTE: This method appends the values to the existing list (if any). Use * {@link #setIdentifiers(java.util.Collection)} or {@link #withIdentifiers(java.util.Collection)} if you want to * override the existing values. *

* * @param identifiers * A list of IDs to use to bind data to a component. Use this property to bind specifically chosen data, * rather than data retrieved from a query. * @return Returns a reference to this object so that method calls can be chained together. */ public ComponentDataConfiguration withIdentifiers(String... identifiers) { if (this.identifiers == null) { setIdentifiers(new java.util.ArrayList(identifiers.length)); } for (String ele : identifiers) { this.identifiers.add(ele); } return this; } /** *

* A list of IDs to use to bind data to a component. Use this property to bind specifically chosen data, rather than * data retrieved from a query. *

* * @param identifiers * A list of IDs to use to bind data to a component. Use this property to bind specifically chosen data, * rather than data retrieved from a query. * @return Returns a reference to this object so that method calls can be chained together. */ public ComponentDataConfiguration withIdentifiers(java.util.Collection identifiers) { setIdentifiers(identifiers); 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 (getModel() != null) sb.append("Model: ").append(getModel()).append(","); if (getSort() != null) sb.append("Sort: ").append(getSort()).append(","); if (getPredicate() != null) sb.append("Predicate: ").append(getPredicate()).append(","); if (getIdentifiers() != null) sb.append("Identifiers: ").append(getIdentifiers()); sb.append("}"); return sb.toString(); } @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (obj instanceof ComponentDataConfiguration == false) return false; ComponentDataConfiguration other = (ComponentDataConfiguration) obj; if (other.getModel() == null ^ this.getModel() == null) return false; if (other.getModel() != null && other.getModel().equals(this.getModel()) == false) return false; if (other.getSort() == null ^ this.getSort() == null) return false; if (other.getSort() != null && other.getSort().equals(this.getSort()) == false) return false; if (other.getPredicate() == null ^ this.getPredicate() == null) return false; if (other.getPredicate() != null && other.getPredicate().equals(this.getPredicate()) == false) return false; if (other.getIdentifiers() == null ^ this.getIdentifiers() == null) return false; if (other.getIdentifiers() != null && other.getIdentifiers().equals(this.getIdentifiers()) == false) return false; return true; } @Override public int hashCode() { final int prime = 31; int hashCode = 1; hashCode = prime * hashCode + ((getModel() == null) ? 0 : getModel().hashCode()); hashCode = prime * hashCode + ((getSort() == null) ? 0 : getSort().hashCode()); hashCode = prime * hashCode + ((getPredicate() == null) ? 0 : getPredicate().hashCode()); hashCode = prime * hashCode + ((getIdentifiers() == null) ? 0 : getIdentifiers().hashCode()); return hashCode; } @Override public ComponentDataConfiguration clone() { try { return (ComponentDataConfiguration) 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.amplifyuibuilder.model.transform.ComponentDataConfigurationMarshaller.getInstance().marshall(this, protocolMarshaller); } }