I have the following code:
public interface Person {
/***
*@Throws Exception x must be greater than 0 ****/
setAge(int x);
}
public class Man implements Person {
setAge(int x) {
if(x <= 0) thrown new Exception("x <= ");
}
}
I broke the DRY principle because I repeat the check in every single implementation and the documentation repeats it too. What's the best way to check the arguments in this situation?