
com.amazonaws.services.accessanalyzer.model.PathElement Maven / Gradle / Ivy
/*
* 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.accessanalyzer.model;
import java.io.Serializable;
import javax.annotation.Generated;
import com.amazonaws.protocol.StructuredPojo;
import com.amazonaws.protocol.ProtocolMarshaller;
/**
*
* A single element in a path through the JSON representation of a policy.
*
*
* @see AWS API
* Documentation
*/
@Generated("com.amazonaws:aws-java-sdk-code-generator")
public class PathElement implements Serializable, Cloneable, StructuredPojo {
/**
*
* Refers to an index in a JSON array.
*
*/
private Integer index;
/**
*
* Refers to a key in a JSON object.
*
*/
private String key;
/**
*
* Refers to a substring of a literal string in a JSON object.
*
*/
private Substring substring;
/**
*
* Refers to the value associated with a given key in a JSON object.
*
*/
private String value;
/**
*
* Refers to an index in a JSON array.
*
*
* @param index
* Refers to an index in a JSON array.
*/
public void setIndex(Integer index) {
this.index = index;
}
/**
*
* Refers to an index in a JSON array.
*
*
* @return Refers to an index in a JSON array.
*/
public Integer getIndex() {
return this.index;
}
/**
*
* Refers to an index in a JSON array.
*
*
* @param index
* Refers to an index in a JSON array.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public PathElement withIndex(Integer index) {
setIndex(index);
return this;
}
/**
*
* Refers to a key in a JSON object.
*
*
* @param key
* Refers to a key in a JSON object.
*/
public void setKey(String key) {
this.key = key;
}
/**
*
* Refers to a key in a JSON object.
*
*
* @return Refers to a key in a JSON object.
*/
public String getKey() {
return this.key;
}
/**
*
* Refers to a key in a JSON object.
*
*
* @param key
* Refers to a key in a JSON object.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public PathElement withKey(String key) {
setKey(key);
return this;
}
/**
*
* Refers to a substring of a literal string in a JSON object.
*
*
* @param substring
* Refers to a substring of a literal string in a JSON object.
*/
public void setSubstring(Substring substring) {
this.substring = substring;
}
/**
*
* Refers to a substring of a literal string in a JSON object.
*
*
* @return Refers to a substring of a literal string in a JSON object.
*/
public Substring getSubstring() {
return this.substring;
}
/**
*
* Refers to a substring of a literal string in a JSON object.
*
*
* @param substring
* Refers to a substring of a literal string in a JSON object.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public PathElement withSubstring(Substring substring) {
setSubstring(substring);
return this;
}
/**
*
* Refers to the value associated with a given key in a JSON object.
*
*
* @param value
* Refers to the value associated with a given key in a JSON object.
*/
public void setValue(String value) {
this.value = value;
}
/**
*
* Refers to the value associated with a given key in a JSON object.
*
*
* @return Refers to the value associated with a given key in a JSON object.
*/
public String getValue() {
return this.value;
}
/**
*
* Refers to the value associated with a given key in a JSON object.
*
*
* @param value
* Refers to the value associated with a given key in a JSON object.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public PathElement withValue(String value) {
setValue(value);
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 (getIndex() != null)
sb.append("Index: ").append(getIndex()).append(",");
if (getKey() != null)
sb.append("Key: ").append(getKey()).append(",");
if (getSubstring() != null)
sb.append("Substring: ").append(getSubstring()).append(",");
if (getValue() != null)
sb.append("Value: ").append(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 PathElement == false)
return false;
PathElement other = (PathElement) obj;
if (other.getIndex() == null ^ this.getIndex() == null)
return false;
if (other.getIndex() != null && other.getIndex().equals(this.getIndex()) == false)
return false;
if (other.getKey() == null ^ this.getKey() == null)
return false;
if (other.getKey() != null && other.getKey().equals(this.getKey()) == false)
return false;
if (other.getSubstring() == null ^ this.getSubstring() == null)
return false;
if (other.getSubstring() != null && other.getSubstring().equals(this.getSubstring()) == 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 + ((getIndex() == null) ? 0 : getIndex().hashCode());
hashCode = prime * hashCode + ((getKey() == null) ? 0 : getKey().hashCode());
hashCode = prime * hashCode + ((getSubstring() == null) ? 0 : getSubstring().hashCode());
hashCode = prime * hashCode + ((getValue() == null) ? 0 : getValue().hashCode());
return hashCode;
}
@Override
public PathElement clone() {
try {
return (PathElement) 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.accessanalyzer.model.transform.PathElementMarshaller.getInstance().marshall(this, protocolMarshaller);
}
}