Skip to content

Instantly share code, notes, and snippets.

@nklmish
Last active November 1, 2017 05:09
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/a69bd2cfd6994c3554943305386a0295 to your computer and use it in GitHub Desktop.
Save nklmish/a69bd2cfd6994c3554943305386a0295 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(when = When.ALWAYS) //When.ALWAYS is default option and makes the annotated type as non-nullable
public String getEchoMessage() {
return greetingMessage;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment