Skip to content

Instantly share code, notes, and snippets.

@nklmish
Last active Nov 1, 2017
Embed
What would you like to do?
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