This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Message { | |
private final String greetingMessage = "Hello "; | |
public String getEchoMessage() { | |
return greetingMessage; | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import javax.annotation.Nonnull; | |
import javax.annotation.meta.When; | |
public class Message { | |
private final String greetingMessage = "Hello "; | |
@Nonnull | |
public String getEchoMessage() { | |
return greetingMessage; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import javax.annotation.Nonnull; | |
import javax.annotation.meta.TypeQualifierDefault; | |
import java.lang.annotation.ElementType; | |
import java.lang.annotation.Retention; | |
import java.lang.annotation.RetentionPolicy; | |
import java.lang.annotation.Target; | |
@Target(ElementType.PACKAGE) | |
@Nonnull | |
@TypeQualifierDefault({ElementType.METHOD, ElementType.PARAMETER}) |