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

查看:739
本文介绍了我何时应该使用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天全站免登陆