All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.urbanairship.api.createandsend.model.audience.email.EmailChannels Maven / Gradle / Ivy

There is a newer version: 9.4.2
Show newest version
package com.urbanairship.api.createandsend.model.audience.email;

import com.google.common.base.Objects;
import com.google.common.collect.ImmutableList;

import java.util.List;

/**
 * Represents the collection of all audience email channels.
 */
public class EmailChannels {
    private final List emailChannels;

    private EmailChannels(Builder builder) {
        emailChannels = builder.emailChannels.build();
    }

    /**
     * EmailChannels Builder
     * @return Builder
     */
    public static Builder newBuilder() {
        return new Builder();
    }

    /**
     * Get the create and send audience email channels.
     * @return List of EmailChannel
     */
    public List getEmailChannels() {
        return emailChannels;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        EmailChannels that = (EmailChannels) o;
        return Objects.equal(emailChannels, that.emailChannels);
    }

    @Override
    public int hashCode() {
        return Objects.hashCode(emailChannels);
    }

    @Override
    public String toString() {
        return "EmailChannels{" +
                "emailChannels=" + emailChannels +
                '}';
    }

    public static class Builder {
        private ImmutableList.Builder emailChannels = ImmutableList.builder();

        /**
         * Add a email channel to create and send to.
         * @param emailChannel RegisterEmailChannel
         * @return EmailChannels Builder
         */
        public Builder addChannel(EmailChannel emailChannel) {
            this.emailChannels.add(emailChannel);
            return this;
        }

        /**
         * Add multiple email channels to create and send to.
         * @param emailChannels RegisterEmailChannel
         * @return EmailChannels Builder
         */
        public Builder addAllChannels(List emailChannels) {
            this.emailChannels.addAll(emailChannels);
            return this;
        }

        public EmailChannels build() {
            return new EmailChannels(this);
        }
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy