public interface MyService {
@NotNull String getGreeting(@NotNull String greetee);
}
public class MyServiceImpl implements MyService {
@NotNull String greeting;
public void setGreeting(String greeting) {
this.greeting = greeting;
}
public String getGreeting(String greetee) {
return greeting + " " + greetee;
}
}
public class TestCase {
public static void main(String[] args) {
MyService myService = new MyServiceImpl();
myService.setGreeting("Hello");
Validator validator = Validation.buildDefaultValidatorFactory().getValidator();
validator.validate(myService); }
}