Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  /*
   * Copyright 2014-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.s3.model;
 
 import java.util.List;
 import java.util.Set;

An abstract class for all the notification configurations associated with an Amazon S3 bucket.
 
 public abstract class NotificationConfiguration {

    
Set of events for a notification configuration.
 
     private Set<Stringevents;

    
A collection of Amazon S3 Object prefixes associated with this notification configuration.
 
     private List<StringobjectPrefixes;

    
Creates a NotificationConfiguration with empty events and prefixes.
 
     protected NotificationConfiguration() {
         this. = new HashSet<String>();
         this. = new ArrayList<String>();
     }

    
Creates a notification configuration with the given set of events.

Parameters:
events the list of events for the notification configuration.
 
     protected NotificationConfiguration(EnumSet<S3Eventevents) {
         this. = new HashSet<String>();
         this. = new ArrayList<String>();
 
         if (events != null) {
             for (S3Event s3Event : events) {
                 this..add(s3Event.toString());
             }
         }
     }

    
Creates a notification configuration with the given set of events.

Parameters:
events the list of events for the notification configuration.
 
     protected NotificationConfiguration(String... events) {
         this. = new HashSet<String>();
         this. = new ArrayList<String>();
 
         if (events != null) {
             for (String event : events) {
                 this..add(event);
             }
         }
     }

    
Returns the set of events associated with this notification configuration.
 
     public Set<StringgetEvents() {
         return ;
     }

    
Sets the given events in this NotificationConfiguration object.

Parameters:
events the set of events for the notification configuration.
 
     public void setEvents(Set<Stringevents) {
         this. = events;
     }

    
Retuns the list of Amazon S3 object prefixes for this notification configuration.
    public List<StringgetObjectPrefixes() {
        return ;
    }

    
Sets the given prefixes in this NotificationConfiguration object.

Parameters:
objectPrefixes the list of prefixes for the notification configuration.
    public void setObjectPrefixes(List<StringobjectPrefixes) {
        this. = objectPrefixes;
    }

    
Sets the given events in this NotificationConfiguration object and returns this object.

Parameters:
events the set of events for the notification configuration.
    public NotificationConfiguration withEvents(Set<Stringevents) {
        this..clear();
        this..addAll(events);
        return this;
    }

    
Sets the given prefixes in this NotificationConfiguration object and returns this object.

Parameters:
objectPrefixes the list of prefixes for the notification configuration.
            String... objectPrefixes) {
        this..clear();
        if (objectPrefixes != null && objectPrefixes.length > 0)
            this..addAll(Arrays.asList(objectPrefixes));
        return this;
    }

    
Adds the given event to the set of events for this NotificationConfiguration object.

Parameters:
event the event to add to this notification configuration
    public void addEvent(String event) {
        this..add(event);
    }

    
Adds the given event to the set of events for this NotificationConfiguration object.

Parameters:
event the event to add to this notification configuration
    public void addEvent(S3Event event) {
        this..add(event.toString());
    }

    
Adds the given prefix to the list of prefix for this NotificationConfiguration object.

Parameters:
prefix the prefix to add to this notification configuration
    public void addObjectPrefix(String prefix) {
        this..add(prefix);
    }
New to GrepCode? Check out our FAQ X