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

com.sap.mobile.services.client.push.LocalizedBulkPush Maven / Gradle / Ivy

The newest version!
package com.sap.mobile.services.client.push;

import java.util.Collection;

import lombok.AccessLevel;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.RequiredArgsConstructor;

/**
 * Root payload element for push service localized bulk
 * push @see
 * Push Service Based Localization. Use the {@link Builder} to define and
 * build the element.
 */
public interface LocalizedBulkPush {

	static Builder builder() {
		return new Builder();
	}

	LocalizedPushPayload getNotification();

	Collection getUserNotifications();

	/**
	 * Helper for server localized bulk push payload creation.
	 */
	@NoArgsConstructor(access = AccessLevel.PRIVATE)
	@AllArgsConstructor(access = AccessLevel.PRIVATE)
	final class Builder {
		private LocalizedPushPayload notification;
		private Collection userNotifications;

		/**
		 * Sets the server localized notifications for all registered devices.
		 * 
		 * @param notification
		 * @return a configured builder with notification for all registered devices.
		 */
		public Builder notification(LocalizedPushPayload notification) {
			return new Builder(notification, this.userNotifications);
		}

		/**
		 * Sets the server localized notification element for users specific
		 * notifications.
		 * 
		 * @param userNotifications
		 * @return a configured builder with user specific notifications.
		 */
		public Builder userNotifications(Collection userNotifications) {
			return new Builder(this.notification, userNotifications);
		}

		/**
		 * @return the server localized localized bulk notification payload.
		 */
		public LocalizedBulkPush build() {
			return new LocalizedBulkPushObject(this.notification, this.userNotifications);
		}

		@Getter
		@RequiredArgsConstructor
		private static final class LocalizedBulkPushObject implements LocalizedBulkPush {
			private final LocalizedPushPayload notification;
			private final Collection userNotifications;
		}
	}
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy