com.amazonaws.services.elasticmapreduce.model.Configuration Maven / Gradle / Ivy
Show all versions of aws-java-sdk-emr Show documentation
/*
* Copyright 2012-2017 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.elasticmapreduce.model;
import java.io.Serializable;
import javax.annotation.Generated;
import com.amazonaws.protocol.StructuredPojo;
import com.amazonaws.protocol.ProtocolMarshaller;
/**
*
*
* Amazon EMR releases 4.x or later.
*
*
*
* An optional configuration specification to be used when provisioning cluster instances, which can include
* configurations for applications and software bundled with Amazon EMR. A configuration consists of a classification,
* properties, and optional nested configurations. A classification refers to an application-specific configuration
* file. Properties are the settings you want to change in that file. For more information, see Configuring Applications.
*
*
* @see AWS API
* Documentation
*/
@Generated("com.amazonaws:aws-java-sdk-code-generator")
public class Configuration implements Serializable, Cloneable, StructuredPojo {
/**
*
* The classification within a configuration.
*
*/
private String classification;
/**
*
* A list of additional configurations to apply within a configuration object.
*
*/
private com.amazonaws.internal.SdkInternalList configurations;
/**
*
* A set of properties specified within a configuration classification.
*
*/
private com.amazonaws.internal.SdkInternalMap properties;
/**
*
* The classification within a configuration.
*
*
* @param classification
* The classification within a configuration.
*/
public void setClassification(String classification) {
this.classification = classification;
}
/**
*
* The classification within a configuration.
*
*
* @return The classification within a configuration.
*/
public String getClassification() {
return this.classification;
}
/**
*
* The classification within a configuration.
*
*
* @param classification
* The classification within a configuration.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public Configuration withClassification(String classification) {
setClassification(classification);
return this;
}
/**
*
* A list of additional configurations to apply within a configuration object.
*
*
* @return A list of additional configurations to apply within a configuration object.
*/
public java.util.List getConfigurations() {
if (configurations == null) {
configurations = new com.amazonaws.internal.SdkInternalList();
}
return configurations;
}
/**
*
* A list of additional configurations to apply within a configuration object.
*
*
* @param configurations
* A list of additional configurations to apply within a configuration object.
*/
public void setConfigurations(java.util.Collection configurations) {
if (configurations == null) {
this.configurations = null;
return;
}
this.configurations = new com.amazonaws.internal.SdkInternalList(configurations);
}
/**
*
* A list of additional configurations to apply within a configuration object.
*
*
* NOTE: This method appends the values to the existing list (if any). Use
* {@link #setConfigurations(java.util.Collection)} or {@link #withConfigurations(java.util.Collection)} if you want
* to override the existing values.
*
*
* @param configurations
* A list of additional configurations to apply within a configuration object.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public Configuration withConfigurations(Configuration... configurations) {
if (this.configurations == null) {
setConfigurations(new com.amazonaws.internal.SdkInternalList(configurations.length));
}
for (Configuration ele : configurations) {
this.configurations.add(ele);
}
return this;
}
/**
*
* A list of additional configurations to apply within a configuration object.
*
*
* @param configurations
* A list of additional configurations to apply within a configuration object.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public Configuration withConfigurations(java.util.Collection configurations) {
setConfigurations(configurations);
return this;
}
/**
*
* A set of properties specified within a configuration classification.
*
*
* @return A set of properties specified within a configuration classification.
*/
public java.util.Map getProperties() {
if (properties == null) {
properties = new com.amazonaws.internal.SdkInternalMap();
}
return properties;
}
/**
*
* A set of properties specified within a configuration classification.
*
*
* @param properties
* A set of properties specified within a configuration classification.
*/
public void setProperties(java.util.Map properties) {
this.properties = properties == null ? null : new com.amazonaws.internal.SdkInternalMap(properties);
}
/**
*
* A set of properties specified within a configuration classification.
*
*
* @param properties
* A set of properties specified within a configuration classification.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public Configuration withProperties(java.util.Map properties) {
setProperties(properties);
return this;
}
public Configuration addPropertiesEntry(String key, String value) {
if (null == this.properties) {
this.properties = new com.amazonaws.internal.SdkInternalMap();
}
if (this.properties.containsKey(key))
throw new IllegalArgumentException("Duplicated keys (" + key.toString() + ") are provided.");
this.properties.put(key, value);
return this;
}
/**
* Removes all the entries added into Properties.
*
* @return Returns a reference to this object so that method calls can be chained together.
*/
public Configuration clearPropertiesEntries() {
this.properties = null;
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 (getClassification() != null)
sb.append("Classification: ").append(getClassification()).append(",");
if (getConfigurations() != null)
sb.append("Configurations: ").append(getConfigurations()).append(",");
if (getProperties() != null)
sb.append("Properties: ").append(getProperties());
sb.append("}");
return sb.toString();
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (obj instanceof Configuration == false)
return false;
Configuration other = (Configuration) obj;
if (other.getClassification() == null ^ this.getClassification() == null)
return false;
if (other.getClassification() != null && other.getClassification().equals(this.getClassification()) == false)
return false;
if (other.getConfigurations() == null ^ this.getConfigurations() == null)
return false;
if (other.getConfigurations() != null && other.getConfigurations().equals(this.getConfigurations()) == false)
return false;
if (other.getProperties() == null ^ this.getProperties() == null)
return false;
if (other.getProperties() != null && other.getProperties().equals(this.getProperties()) == false)
return false;
return true;
}
@Override
public int hashCode() {
final int prime = 31;
int hashCode = 1;
hashCode = prime * hashCode + ((getClassification() == null) ? 0 : getClassification().hashCode());
hashCode = prime * hashCode + ((getConfigurations() == null) ? 0 : getConfigurations().hashCode());
hashCode = prime * hashCode + ((getProperties() == null) ? 0 : getProperties().hashCode());
return hashCode;
}
@Override
public Configuration clone() {
try {
return (Configuration) 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.elasticmapreduce.model.transform.ConfigurationMarshaller.getInstance().marshall(this, protocolMarshaller);
}
}