import com.microsoft.azure.annotations.Nullable;
import com.microsoft.azure.annotations.IntRange;
public class Calculator {
public static void main(String[] args) {
Calculator calculator = new Calculator();
calculator.add(10, 20);
}
public int add(@IntRange(from = 0, to = 100) int num1, @Nullable Integer num2) {
if (num2 == null) {
return num1;
}
return num1 + num2;
}
}
<dependency>
<groupId>com.microsoft.azure</groupId>
<artifactId>azure-annotations</artifactId>
<version>1.0.0</version>
</dependency>