我什么时候应该使用 Apache Commons 的 Validate.isTrue,什么时候应该只使用 'assert' 关键字? [英] When should I use Apache Commons' Validate.isTrue, and when should I just use the 'assert' keyword?

查看:31
本文介绍了我什么时候应该使用 Apache Commons 的 Validate.isTrue,什么时候应该只使用 'assert' 关键字?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

什么时候应该使用 Apache Commons 的 Validate.isTrue,什么时候应该只使用 'assert' 关键字?

When should I use Apache Commons' Validate.isTrue, and when should I just use the 'assert' keyword?

推荐答案

断言可以关闭(实际上,它们通常是),因此它们对于验证用户输入没有用,例如.

Assertions can be turned off (in fact, they normally are), so they are not useful for validating user input, for example.

这篇关于我什么时候应该使用 Apache Commons 的 Validate.isTrue,什么时候应该只使用 'assert' 关键字?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆