com.amazonaws.services.storagegateway.model.NetworkInterface Maven / Gradle / Ivy
/*
* Copyright 2011-2016 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.storagegateway.model;
import java.io.Serializable;
/**
*
* Describes a gateway's network interface.
*
*/
public class NetworkInterface implements Serializable, Cloneable {
/**
*
* The Internet Protocol version 4 (IPv4) address of the interface.
*
*/
private String ipv4Address;
/**
*
* The Media Access Control (MAC) address of the interface.
*
*
*
* This is currently unsupported and will not be returned in output.
*
*
*/
private String macAddress;
/**
*
* The Internet Protocol version 6 (IPv6) address of the interface.
* Currently not supported.
*
*/
private String ipv6Address;
/**
*
* The Internet Protocol version 4 (IPv4) address of the interface.
*
*
* @param ipv4Address
* The Internet Protocol version 4 (IPv4) address of the interface.
*/
public void setIpv4Address(String ipv4Address) {
this.ipv4Address = ipv4Address;
}
/**
*
* The Internet Protocol version 4 (IPv4) address of the interface.
*
*
* @return The Internet Protocol version 4 (IPv4) address of the interface.
*/
public String getIpv4Address() {
return this.ipv4Address;
}
/**
*
* The Internet Protocol version 4 (IPv4) address of the interface.
*
*
* @param ipv4Address
* The Internet Protocol version 4 (IPv4) address of the interface.
* @return Returns a reference to this object so that method calls can be
* chained together.
*/
public NetworkInterface withIpv4Address(String ipv4Address) {
setIpv4Address(ipv4Address);
return this;
}
/**
*
* The Media Access Control (MAC) address of the interface.
*
*
*
* This is currently unsupported and will not be returned in output.
*
*
*
* @param macAddress
* The Media Access Control (MAC) address of the interface.
*
*
* This is currently unsupported and will not be returned in output.
*
*/
public void setMacAddress(String macAddress) {
this.macAddress = macAddress;
}
/**
*
* The Media Access Control (MAC) address of the interface.
*
*
*
* This is currently unsupported and will not be returned in output.
*
*
*
* @return The Media Access Control (MAC) address of the interface.
*
*
* This is currently unsupported and will not be returned in output.
*
*/
public String getMacAddress() {
return this.macAddress;
}
/**
*
* The Media Access Control (MAC) address of the interface.
*
*
*
* This is currently unsupported and will not be returned in output.
*
*
*
* @param macAddress
* The Media Access Control (MAC) address of the interface.
*
*
* This is currently unsupported and will not be returned in output.
*
* @return Returns a reference to this object so that method calls can be
* chained together.
*/
public NetworkInterface withMacAddress(String macAddress) {
setMacAddress(macAddress);
return this;
}
/**
*
* The Internet Protocol version 6 (IPv6) address of the interface.
* Currently not supported.
*
*
* @param ipv6Address
* The Internet Protocol version 6 (IPv6) address of the interface.
* Currently not supported.
*/
public void setIpv6Address(String ipv6Address) {
this.ipv6Address = ipv6Address;
}
/**
*
* The Internet Protocol version 6 (IPv6) address of the interface.
* Currently not supported.
*
*
* @return The Internet Protocol version 6 (IPv6) address of the interface.
* Currently not supported.
*/
public String getIpv6Address() {
return this.ipv6Address;
}
/**
*
* The Internet Protocol version 6 (IPv6) address of the interface.
* Currently not supported.
*
*
* @param ipv6Address
* The Internet Protocol version 6 (IPv6) address of the interface.
* Currently not supported.
* @return Returns a reference to this object so that method calls can be
* chained together.
*/
public NetworkInterface withIpv6Address(String ipv6Address) {
setIpv6Address(ipv6Address);
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 (getIpv4Address() != null)
sb.append("Ipv4Address: " + getIpv4Address() + ",");
if (getMacAddress() != null)
sb.append("MacAddress: " + getMacAddress() + ",");
if (getIpv6Address() != null)
sb.append("Ipv6Address: " + getIpv6Address());
sb.append("}");
return sb.toString();
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (obj instanceof NetworkInterface == false)
return false;
NetworkInterface other = (NetworkInterface) obj;
if (other.getIpv4Address() == null ^ this.getIpv4Address() == null)
return false;
if (other.getIpv4Address() != null
&& other.getIpv4Address().equals(this.getIpv4Address()) == false)
return false;
if (other.getMacAddress() == null ^ this.getMacAddress() == null)
return false;
if (other.getMacAddress() != null
&& other.getMacAddress().equals(this.getMacAddress()) == false)
return false;
if (other.getIpv6Address() == null ^ this.getIpv6Address() == null)
return false;
if (other.getIpv6Address() != null
&& other.getIpv6Address().equals(this.getIpv6Address()) == false)
return false;
return true;
}
@Override
public int hashCode() {
final int prime = 31;
int hashCode = 1;
hashCode = prime
* hashCode
+ ((getIpv4Address() == null) ? 0 : getIpv4Address().hashCode());
hashCode = prime * hashCode
+ ((getMacAddress() == null) ? 0 : getMacAddress().hashCode());
hashCode = prime
* hashCode
+ ((getIpv6Address() == null) ? 0 : getIpv6Address().hashCode());
return hashCode;
}
@Override
public NetworkInterface clone() {
try {
return (NetworkInterface) super.clone();
} catch (CloneNotSupportedException e) {
throw new IllegalStateException(
"Got a CloneNotSupportedException from Object.clone() "
+ "even though we're Cloneable!", e);
}
}
}