org.springframework.util.assert
assert翻译为中文为断言.
大概来说,就是断定某一个实际的值就为自己预期想得到的,如果不一样就抛出异常.
spring源码如下:
/**
* assert that an object is not <code>null</code> .
* <pre class="code">assert.notnull(clazz, the class must not be null);</pre>
* @param object the object to check
* @param message the exception message to use if the assertion fails
* @throws illegalargumentexception if the object is <code>null</code>
*/
public static void notnull(object object, string message) {
if (object == null) {
throw new illegalargumentexception(message);
}
}
该函数的意思是传入的object必须不能为空。如果为空就抛出异常。
以上就是java--assert.notnull的详细内容。
