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

Describes an event.

 
 public class Event implements SerializableCloneable {

    
The identifier for the source of the event.
 
     private String sourceIdentifier;

    
The source type for this event.

Constraints:
Allowed Values: cluster, cluster-parameter-group, cluster-security-group, cluster-snapshot

 
     private String sourceType;

    
The text of this event.
 
     private String message;

    
A list of the event categories.
 
The severity of the event.

Values: ERROR, INFO

 
     private String severity;

    
The date and time of the event.
 
     private java.util.Date date;

    
The identifier of the event.
 
     private String eventId;

    
The identifier for the source of the event.

Returns:
The identifier for the source of the event.
 
     public String getSourceIdentifier() {
         return ;
     }
    
    
The identifier for the source of the event.

Parameters:
sourceIdentifier The identifier for the source of the event.
 
     public void setSourceIdentifier(String sourceIdentifier) {
         this. = sourceIdentifier;
     }
    
    
The identifier for the source of the event.

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

Parameters:
sourceIdentifier The identifier for the source of the event.
Returns:
A reference to this updated object so that method calls can be chained together.
 
     public Event withSourceIdentifier(String sourceIdentifier) {
         this. = sourceIdentifier;
         return this;
     }

    
The source type for this event.

Constraints:
Allowed Values: cluster, cluster-parameter-group, cluster-security-group, cluster-snapshot

Returns:
The source type for this event.
See also:
SourceType
    public String getSourceType() {
        return ;
    }
    
    
The source type for this event.

Constraints:
Allowed Values: cluster, cluster-parameter-group, cluster-security-group, cluster-snapshot

Parameters:
sourceType The source type for this event.
See also:
SourceType
    public void setSourceType(String sourceType) {
        this. = sourceType;
    }
    
    
The source type for this event.

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

Constraints:
Allowed Values: cluster, cluster-parameter-group, cluster-security-group, cluster-snapshot

Parameters:
sourceType The source type for this event.
Returns:
A reference to this updated object so that method calls can be chained together.
See also:
SourceType
    public Event withSourceType(String sourceType) {
        this. = sourceType;
        return this;
    }

    
The source type for this event.

Constraints:
Allowed Values: cluster, cluster-parameter-group, cluster-security-group, cluster-snapshot

Parameters:
sourceType The source type for this event.
See also:
SourceType
    public void setSourceType(SourceType sourceType) {
        this. = sourceType.toString();
    }
    
    
The source type for this event.

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

Constraints:
Allowed Values: cluster, cluster-parameter-group, cluster-security-group, cluster-snapshot

Parameters:
sourceType The source type for this event.
Returns:
A reference to this updated object so that method calls can be chained together.
See also:
SourceType
    public Event withSourceType(SourceType sourceType) {
        this. = sourceType.toString();
        return this;
    }

    
The text of this event.

Returns:
The text of this event.
    public String getMessage() {
        return ;
    }
    
    
The text of this event.

Parameters:
message The text of this event.
    public void setMessage(String message) {
        this. = message;
    }
    
    
The text of this event.

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

Parameters:
message The text of this event.
Returns:
A reference to this updated object so that method calls can be chained together.
    public Event withMessage(String message) {
        this. = message;
        return this;
    }

    
A list of the event categories.

Returns:
A list of the event categories.
    public java.util.List<StringgetEventCategories() {
        if ( == null) {
               = new com.amazonaws.internal.ListWithAutoConstructFlag<String>();
              .setAutoConstruct(true);
        }
        return ;
    }
    
    
A list of the event categories.

Parameters:
eventCategories A list of the event categories.
    public void setEventCategories(java.util.Collection<StringeventCategories) {
        if (eventCategories == null) {
            this. = null;
            return;
        }
        com.amazonaws.internal.ListWithAutoConstructFlag<StringeventCategoriesCopy = new com.amazonaws.internal.ListWithAutoConstructFlag<String>(eventCategories.size());
        eventCategoriesCopy.addAll(eventCategories);
        this. = eventCategoriesCopy;
    }
    
    
A list of the event categories.

NOTE: This method appends the values to the existing list (if any). Use setEventCategories(java.util.Collection) or withEventCategories(java.util.Collection) if you want to override the existing values.

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

Parameters:
eventCategories A list of the event categories.
Returns:
A reference to this updated object so that method calls can be chained together.
    public Event withEventCategories(String... eventCategories) {
        if (getEventCategories() == nullsetEventCategories(new java.util.ArrayList<String>(eventCategories.length));
        for (String value : eventCategories) {
            getEventCategories().add(value);
        }
        return this;
    }
    
    
A list of the event categories.

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

Parameters:
eventCategories A list of the event categories.
Returns:
A reference to this updated object so that method calls can be chained together.
    public Event withEventCategories(java.util.Collection<StringeventCategories) {
        if (eventCategories == null) {
            this. = null;
        } else {
            com.amazonaws.internal.ListWithAutoConstructFlag<StringeventCategoriesCopy = new com.amazonaws.internal.ListWithAutoConstructFlag<String>(eventCategories.size());
            eventCategoriesCopy.addAll(eventCategories);
            this. = eventCategoriesCopy;
        }
        return this;
    }

    
The severity of the event.

Values: ERROR, INFO

Returns:
The severity of the event.

Values: ERROR, INFO

    public String getSeverity() {
        return ;
    }
    
    
The severity of the event.

Values: ERROR, INFO

Parameters:
severity The severity of the event.

Values: ERROR, INFO

    public void setSeverity(String severity) {
        this. = severity;
    }
    
    
The severity of the event.

Values: ERROR, INFO

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

Parameters:
severity The severity of the event.

Values: ERROR, INFO

Returns:
A reference to this updated object so that method calls can be chained together.
    public Event withSeverity(String severity) {
        this. = severity;
        return this;
    }

    
The date and time of the event.

Returns:
The date and time of the event.
    public java.util.Date getDate() {
        return ;
    }
    
    
The date and time of the event.

Parameters:
date The date and time of the event.
    public void setDate(java.util.Date date) {
        this. = date;
    }
    
    
The date and time of the event.

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

Parameters:
date The date and time of the event.
Returns:
A reference to this updated object so that method calls can be chained together.
    public Event withDate(java.util.Date date) {
        this. = date;
        return this;
    }

    
The identifier of the event.

Returns:
The identifier of the event.
    public String getEventId() {
        return ;
    }
    
    
The identifier of the event.

Parameters:
eventId The identifier of the event.
    public void setEventId(String eventId) {
        this. = eventId;
    }
    
    
The identifier of the event.

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

Parameters:
eventId The identifier of the event.
Returns:
A reference to this updated object so that method calls can be chained together.
    public Event withEventId(String eventId) {
        this. = eventId;
        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 (getSourceIdentifier() != nullsb.append("SourceIdentifier: " + getSourceIdentifier() + ",");
        if (getSourceType() != nullsb.append("SourceType: " + getSourceType() + ",");
        if (getMessage() != nullsb.append("Message: " + getMessage() + ",");
        if (getEventCategories() != nullsb.append("EventCategories: " + getEventCategories() + ",");
        if (getSeverity() != nullsb.append("Severity: " + getSeverity() + ",");
        if (getDate() != nullsb.append("Date: " + getDate() + ",");
        if (getEventId() != nullsb.append("EventId: " + getEventId() );
        sb.append("}");
        return sb.toString();
    }
    
    @Override
    public int hashCode() {
        final int prime = 31;
        int hashCode = 1;
        
        hashCode = prime * hashCode + ((getSourceIdentifier() == null) ? 0 : getSourceIdentifier().hashCode()); 
        hashCode = prime * hashCode + ((getSourceType() == null) ? 0 : getSourceType().hashCode()); 
        hashCode = prime * hashCode + ((getMessage() == null) ? 0 : getMessage().hashCode()); 
        hashCode = prime * hashCode + ((getEventCategories() == null) ? 0 : getEventCategories().hashCode()); 
        hashCode = prime * hashCode + ((getSeverity() == null) ? 0 : getSeverity().hashCode()); 
        hashCode = prime * hashCode + ((getDate() == null) ? 0 : getDate().hashCode()); 
        hashCode = prime * hashCode + ((getEventId() == null) ? 0 : getEventId().hashCode()); 
        return hashCode;
    }
    
    @Override
    public boolean equals(Object obj) {
        if (this == objreturn true;
        if (obj == nullreturn false;
        if (obj instanceof Event == falsereturn false;
        Event other = (Event)obj;
        
        if (other.getSourceIdentifier() == null ^ this.getSourceIdentifier() == nullreturn false;
        if (other.getSourceIdentifier() != null && other.getSourceIdentifier().equals(this.getSourceIdentifier()) == falsereturn false
        if (other.getSourceType() == null ^ this.getSourceType() == nullreturn false;
        if (other.getSourceType() != null && other.getSourceType().equals(this.getSourceType()) == falsereturn false
        if (other.getMessage() == null ^ this.getMessage() == nullreturn false;
        if (other.getMessage() != null && other.getMessage().equals(this.getMessage()) == falsereturn false
        if (other.getEventCategories() == null ^ this.getEventCategories() == nullreturn false;
        if (other.getEventCategories() != null && other.getEventCategories().equals(this.getEventCategories()) == falsereturn false
        if (other.getSeverity() == null ^ this.getSeverity() == nullreturn false;
        if (other.getSeverity() != null && other.getSeverity().equals(this.getSeverity()) == falsereturn false
        if (other.getDate() == null ^ this.getDate() == nullreturn false;
        if (other.getDate() != null && other.getDate().equals(this.getDate()) == falsereturn false
        if (other.getEventId() == null ^ this.getEventId() == nullreturn false;
        if (other.getEventId() != null && other.getEventId().equals(this.getEventId()) == falsereturn false
        return true;
    }
    
    @Override
    public Event clone() {
        try {
            return (Eventsuper.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