Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  /*
   * Copyright 2010-2015 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;
 

Describes a gateway's network interface.

 
 public class NetworkInterface implements SerializableCloneable {

    
The Internet Protocol version 4 (IPv4) address of the interface.
 
     private String ipv4Address;

    
The Media Access Control (MAC) address of the interface. <note>This is currently unsupported and will not be returned in output.</note>
 
     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.

Returns:
The Internet Protocol version 4 (IPv4) address of the interface.
 
     public String getIpv4Address() {
         return ;
     }
    
    
The Internet Protocol version 4 (IPv4) address of the interface.

Parameters:
ipv4Address The Internet Protocol version 4 (IPv4) address of the interface.
 
     public void setIpv4Address(String ipv4Address) {
         this. = ipv4Address;
     }
    
    
The Internet Protocol version 4 (IPv4) address of the interface.

Returns a reference to this object so that method calls can be chained together.

Parameters:
ipv4Address The Internet Protocol version 4 (IPv4) address of the interface.
Returns:
A reference to this updated object so that method calls can be chained together.
 
     public NetworkInterface withIpv4Address(String ipv4Address) {
         this. = ipv4Address;
         return this;
     }

    
The Media Access Control (MAC) address of the interface. <note>This is currently unsupported and will not be returned in output.</note>

Returns:
The Media Access Control (MAC) address of the interface. <note>This is currently unsupported and will not be returned in output.</note>
 
     public String getMacAddress() {
         return ;
     }
    
    
The Media Access Control (MAC) address of the interface. <note>This is currently unsupported and will not be returned in output.</note>

Parameters:
macAddress The Media Access Control (MAC) address of the interface. <note>This is currently unsupported and will not be returned in output.</note>
 
     public void setMacAddress(String macAddress) {
         this. = macAddress;
     }
    
    
The Media Access Control (MAC) address of the interface. <note>This is currently unsupported and will not be returned in output.</note>

Returns a reference to this object so that method calls can be chained together.

Parameters:
macAddress The Media Access Control (MAC) address of the interface. <note>This is currently unsupported and will not be returned in output.</note>
Returns:
A reference to this updated object so that method calls can be chained together.
    public NetworkInterface withMacAddress(String macAddress) {
        this. = macAddress;
        return this;
    }

    
The Internet Protocol version 6 (IPv6) address of the interface. Currently not supported.

Returns:
The Internet Protocol version 6 (IPv6) address of the interface. Currently not supported.
    public String getIpv6Address() {
        return ;
    }
    
    
The Internet Protocol version 6 (IPv6) address of the interface. Currently not supported.

Parameters:
ipv6Address The Internet Protocol version 6 (IPv6) address of the interface. Currently not supported.
    public void setIpv6Address(String ipv6Address) {
        this. = ipv6Address;
    }
    
    
The Internet Protocol version 6 (IPv6) address of the interface. Currently not supported.

Returns a reference to this object so that method calls can be chained together.

Parameters:
ipv6Address The Internet Protocol version 6 (IPv6) address of the interface. Currently not supported.
Returns:
A reference to this updated object so that method calls can be chained together.
    public NetworkInterface withIpv6Address(String ipv6Address) {
        this. = ipv6Address;
        return this;
    }

    
Returns a string representation of this object; useful for testing and debugging.

Returns:
A string representation of this object.
See also:
java.lang.Object.toString()
    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append("{");
        if (getIpv4Address() != nullsb.append("Ipv4Address: " + getIpv4Address() + ",");
        if (getMacAddress() != nullsb.append("MacAddress: " + getMacAddress() + ",");
        if (getIpv6Address() != nullsb.append("Ipv6Address: " + getIpv6Address() );
        sb.append("}");
        return sb.toString();
    }
    
    @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 boolean equals(Object obj) {
        if (this == objreturn true;
        if (obj == nullreturn false;
        if (obj instanceof NetworkInterface == falsereturn false;
        NetworkInterface other = (NetworkInterface)obj;
        
        if (other.getIpv4Address() == null ^ this.getIpv4Address() == nullreturn false;
        if (other.getIpv4Address() != null && other.getIpv4Address().equals(this.getIpv4Address()) == falsereturn false
        if (other.getMacAddress() == null ^ this.getMacAddress() == nullreturn false;
        if (other.getMacAddress() != null && other.getMacAddress().equals(this.getMacAddress()) == falsereturn false
        if (other.getIpv6Address() == null ^ this.getIpv6Address() == nullreturn false;
        if (other.getIpv6Address() != null && other.getIpv6Address().equals(this.getIpv6Address()) == falsereturn false
        return true;
    }
    
    @Override
    public NetworkInterface clone() {
        try {
            return (NetworkInterfacesuper.clone();
        
        } catch (CloneNotSupportedException e) {
            throw new IllegalStateException(
                    "Got a CloneNotSupportedException from Object.clone() "
                    + "even though we're Cloneable!",
                    e);
        }
        
    }
}
    
New to GrepCode? Check out our FAQ X