Skip to content

Instantly share code, notes, and snippets.

@nklmish
Last active November 1, 2017 07:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nklmish/288d254a57888adbccca313f2707503f to your computer and use it in GitHub Desktop.
Save nklmish/288d254a57888adbccca313f2707503f to your computer and use it in GitHub Desktop.
import javax.annotation.Nonnull;
import javax.annotation.meta.When;
public class Message {
private final String greetingMessage = "Hello ";
@Nonnull
public String getEchoMessage() {
return greetingMessage;
}
@Nonnull(when = When.MAYBE)
public String getThirdPartyMessage() {
return fetchFromExternalService();
}
@Nonnull(when = When.UNKNOWN)
public String getDummyMessage() {
return "foo";
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment