其他
Local Validator
Local Validator library provides a small set of classes that will help you to perform local validation in your code. Using the Local Validator library, your code will be cleaner and easier to understand. Using the Local Validator library, you will be able to validate local objects without increasing method's cyclomatic complexity.
Local Validator library is available to following programming languages:
- Java
- Python
The following code snippets show usage examples of Local Validator library.
Java example:
``` // Without Local Validator. void myMethod1(Object arg1, int arg2) { if (arg1 == null) { throw new NullPointerException(); }
if (arg2 < 0) { throw new MyRuntimeException(); }
// method's body. }
// With Local validator void myMethod2(Object arg1, int arg2) { new LocalValidationContext() .addNotNullChecking(arg1) .addValidCondition((arg2 >= 0), MyRuntimeException.c
暂无评论