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.sns.model;
 

A wrapper type for the attributes of an Amazon SNS subscription.

 
 public class Subscription implements SerializableCloneable {

    
The subscription's ARN.
 
     private String subscriptionArn;

    
The subscription's owner.
 
     private String owner;

    
The subscription's protocol.
 
     private String protocol;

    
The subscription's endpoint (format depends on the protocol).
 
     private String endpoint;

    
The ARN of the subscription's topic.
 
     private String topicArn;

    
Default constructor for a new Subscription object. Callers should use the setter or fluent setter (with...) methods to initialize this object after creating it.
 
     public Subscription() {}
    
    
The subscription's ARN.

Returns:
The subscription's ARN.
 
     public String getSubscriptionArn() {
         return ;
     }
    
    
The subscription's ARN.

Parameters:
subscriptionArn The subscription's ARN.
 
     public void setSubscriptionArn(String subscriptionArn) {
         this. = subscriptionArn;
     }
    
    
The subscription's ARN.

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

Parameters:
subscriptionArn The subscription's ARN.
Returns:
A reference to this updated object so that method calls can be chained together.
 
     public Subscription withSubscriptionArn(String subscriptionArn) {
         this. = subscriptionArn;
         return this;
     }

    
The subscription's owner.

Returns:
The subscription's owner.
 
     public String getOwner() {
         return ;
     }
    
    
The subscription's owner.

Parameters:
owner The subscription's owner.
    public void setOwner(String owner) {
        this. = owner;
    }
    
    
The subscription's owner.

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

Parameters:
owner The subscription's owner.
Returns:
A reference to this updated object so that method calls can be chained together.
    public Subscription withOwner(String owner) {
        this. = owner;
        return this;
    }

    
The subscription's protocol.

Returns:
The subscription's protocol.
    public String getProtocol() {
        return ;
    }
    
    
The subscription's protocol.

Parameters:
protocol The subscription's protocol.
    public void setProtocol(String protocol) {
        this. = protocol;
    }
    
    
The subscription's protocol.

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

Parameters:
protocol The subscription's protocol.
Returns:
A reference to this updated object so that method calls can be chained together.
    public Subscription withProtocol(String protocol) {
        this. = protocol;
        return this;
    }

    
The subscription's endpoint (format depends on the protocol).

Returns:
The subscription's endpoint (format depends on the protocol).
    public String getEndpoint() {
        return ;
    }
    
    
The subscription's endpoint (format depends on the protocol).

Parameters:
endpoint The subscription's endpoint (format depends on the protocol).
    public void setEndpoint(String endpoint) {
        this. = endpoint;
    }
    
    
The subscription's endpoint (format depends on the protocol).

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

Parameters:
endpoint The subscription's endpoint (format depends on the protocol).
Returns:
A reference to this updated object so that method calls can be chained together.
    public Subscription withEndpoint(String endpoint) {
        this. = endpoint;
        return this;
    }

    
The ARN of the subscription's topic.

Returns:
The ARN of the subscription's topic.
    public String getTopicArn() {
        return ;
    }
    
    
The ARN of the subscription's topic.

Parameters:
topicArn The ARN of the subscription's topic.
    public void setTopicArn(String topicArn) {
        this. = topicArn;
    }
    
    
The ARN of the subscription's topic.

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

Parameters:
topicArn The ARN of the subscription's topic.
Returns:
A reference to this updated object so that method calls can be chained together.
    public Subscription withTopicArn(String topicArn) {
        this. = topicArn;
        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 (getSubscriptionArn() != nullsb.append("SubscriptionArn: " + getSubscriptionArn() + ",");
        if (getOwner() != nullsb.append("Owner: " + getOwner() + ",");
        if (getProtocol() != nullsb.append("Protocol: " + getProtocol() + ",");
        if (getEndpoint() != nullsb.append("Endpoint: " + getEndpoint() + ",");
        if (getTopicArn() != nullsb.append("TopicArn: " + getTopicArn() );
        sb.append("}");
        return sb.toString();
    }
    
    @Override
    public int hashCode() {
        final int prime = 31;
        int hashCode = 1;
        
        hashCode = prime * hashCode + ((getSubscriptionArn() == null) ? 0 : getSubscriptionArn().hashCode()); 
        hashCode = prime * hashCode + ((getOwner() == null) ? 0 : getOwner().hashCode()); 
        hashCode = prime * hashCode + ((getProtocol() == null) ? 0 : getProtocol().hashCode()); 
        hashCode = prime * hashCode + ((getEndpoint() == null) ? 0 : getEndpoint().hashCode()); 
        hashCode = prime * hashCode + ((getTopicArn() == null) ? 0 : getTopicArn().hashCode()); 
        return hashCode;
    }
    
    @Override
    public boolean equals(Object obj) {
        if (this == objreturn true;
        if (obj == nullreturn false;
        if (obj instanceof Subscription == falsereturn false;
        Subscription other = (Subscription)obj;
        
        if (other.getSubscriptionArn() == null ^ this.getSubscriptionArn() == nullreturn false;
        if (other.getSubscriptionArn() != null && other.getSubscriptionArn().equals(this.getSubscriptionArn()) == falsereturn false
        if (other.getOwner() == null ^ this.getOwner() == nullreturn false;
        if (other.getOwner() != null && other.getOwner().equals(this.getOwner()) == falsereturn false
        if (other.getProtocol() == null ^ this.getProtocol() == nullreturn false;
        if (other.getProtocol() != null && other.getProtocol().equals(this.getProtocol()) == falsereturn false
        if (other.getEndpoint() == null ^ this.getEndpoint() == nullreturn false;
        if (other.getEndpoint() != null && other.getEndpoint().equals(this.getEndpoint()) == falsereturn false
        if (other.getTopicArn() == null ^ this.getTopicArn() == nullreturn false;
        if (other.getTopicArn() != null && other.getTopicArn().equals(this.getTopicArn()) == falsereturn false
        return true;
    }
    
    @Override
    public Subscription clone() {
        try {
            return (Subscriptionsuper.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