Skip to content
This repository has been archived by the owner on Dec 1, 2022. It is now read-only.

Remove java.util.Optional as we are using java 1.7 #233

Merged
merged 3 commits into from
Jan 17, 2017
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Remove java.util.Optional as we are using java 1.7
  • Loading branch information
dgnemo authored Jan 17, 2017
commit e8b687001936f63edc3e2d5aaa7e508fa23f0ba8
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
*/
package com.google.android.gcm.server;

import static com.google.android.gcm.server.Constants.FCM_SEND_ENDPOINT;
import static com.google.android.gcm.server.Constants.JSON_CANONICAL_IDS;
import static com.google.android.gcm.server.Constants.JSON_ERROR;
import static com.google.android.gcm.server.Constants.JSON_FAILURE;
Expand Down Expand Up @@ -70,7 +69,6 @@
import java.util.Random;
import java.util.logging.Level;
import java.util.logging.Logger;
import java.util.Optional;

/**
* Helper class to send messages to the GCM service using an API Key.
Expand Down Expand Up @@ -105,16 +103,22 @@ public class Sender {
* @param key API key obtained through the Google API Console.
*/
public Sender(String key) {
this.key = nonNull(key);
this(key, Constants.FCM_SEND_ENDPOINT);
}

/**
* Full options constructor.
*
* @param key FCM Server Key obtained through the Firebase Web Console.
* @param endpoint Endpoint to use when sending the message.
*/
public Sender(String key, String endpoint) {
this(key);
this.endpoint = endpoint;
this.key = nonNull(key);
this.endpoint = nonNull(endpoint);
}

public String getEndpoint() {
return Optional.ofNullable(endpoint).orElse(FCM_SEND_ENDPOINT);
return endpoint;
}

/**
Expand Down