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

com.urbanairship.api.channel.model.web.WebSettings Maven / Gradle / Ivy

There is a newer version: 9.4.2
Show newest version
package com.urbanairship.api.channel.model.web;

import com.google.common.base.Objects;

import java.util.Optional;

/**
 * Displayed only for Web channels. Describes the fields from the web subscription submitted in CRA.
 */
public final class WebSettings {

    private final Optional subscription;

    private WebSettings(Optional subscription) {
        this.subscription = subscription;
    }

    /**
     * Get the Subscription object. Required for signing the push package.
     *
     * @return Subscription
     */
    public Optional getSubscription() {
        return subscription;
    }

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

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

    @Override
    public String toString() {
        return "WebSettings{" +
                "subscription=" + subscription +
                '}';
    }

    /**
     * New WebSettings Builder.
     *
     * @return WebSettings Builder
     */
    public static Builder newBuilder() {
        return new Builder();
    }

    /**
     * WebSettings Builder
     */
    public final static class Builder {

        private Subscription subscription = null;

        private Builder() {
        }

        /**
         * Set the subscription object. Required for signing the push package.
         * @param subscription A web {@link Subscription}
         * @return WebSettings Builder
         */
        public Builder setSubscription(Subscription subscription) {
            this.subscription = subscription;
            return this;
        }

        public WebSettings build() {
            return new WebSettings(Optional.ofNullable(subscription));
        }
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy