Skip to content

Commit

Permalink
Changing return value to optional
Browse files Browse the repository at this point in the history
  • Loading branch information
colinmccloskey committed Nov 29, 2023
1 parent 263bf38 commit 66edcf9
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/main/java/com/meta/cp4m/message/FBMessageHandler.java
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ public FBMessageHandler(String verifyToken, String pageAccessToken, String appSe
this.verifyToken = config.verifyToken();
this.appSecret = config.appSecret();
this.accessToken = config.pageAccessToken();
this.connectedFacebookPageForInstagram = config.connectedFacebookPageForInstagram();
this.connectedFacebookPageForInstagram = config.connectedFacebookPageForInstagram().isPresent() ? config.connectedFacebookPageForInstagram().get() : null;
}

@Override
Expand Down
9 changes: 4 additions & 5 deletions src/main/java/com/meta/cp4m/message/FBMessengerConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

import com.fasterxml.jackson.annotation.JsonProperty;
import com.google.common.base.Preconditions;
import org.jetbrains.annotations.Nullable;
import org.checkerframework.checker.nullness.qual.Nullable;

import java.util.Optional;
import java.util.UUID;
Expand All @@ -21,8 +21,7 @@ public class FBMessengerConfig implements HandlerConfig {
private final String verifyToken;
private final String appSecret;
private final String pageAccessToken;
@Nullable
private final String connectedFacebookPageForInstagram;
private final @Nullable String connectedFacebookPageForInstagram;

private FBMessengerConfig(
@JsonProperty("name") String name,
Expand Down Expand Up @@ -80,7 +79,7 @@ public String pageAccessToken() {
return pageAccessToken;
}

public String connectedFacebookPageForInstagram() {
return connectedFacebookPageForInstagram;
public @Nullable Optional<String> connectedFacebookPageForInstagram() {
return Optional.ofNullable(connectedFacebookPageForInstagram);
}
}

0 comments on commit 66edcf9

Please sign in to comment.