spring源码之—Assert.notNull
2021-07-13 19:06
标签:The 分享 进入 概念 hat div unit check fail spring源码之—Assert.notNull 标签:The 分享 进入 概念 hat div unit check fail 原文地址:https://www.cnblogs.com/jpfss/p/9541397.htmlorg.springframework.core.io.support.EncodedResource中
public EncodedResource(Resource resource, String encoding) {
Assert.notNull("Resource is required");
this.resource = resource;
this.encoding = encoding;
}
Assert.notNull("Resource is required");
Assert.notNull(resource,"Resource is required");
/**
* Assert that an object is not
null
.
* Assert.notNull(clazz, "The class must not be null");
* @param object the object to check
* @param message the exception message to use if the assertion fails
* @throws IllegalArgumentException if the object is null
*/
public static void notNull(Object object, String message) {
if (object == null) {
throw new IllegalArgumentException(message);
}
}