「Spring」Assert.notNull()メソッドでNullを判別する方法
使用例1
public static void getUser(String userId,String depId) {
Assert.notNull(userId, "userId must not be null");
Assert.notNull(depId, "depId must not be null");
// some code
}
使用例2
WebApplicationContext ctx = ContextLoader.getCurrentWebApplicationContext(); Assert.notNull(ctx, "crx must not be null");
使用例3
public List<User> getUserInfo(List<Depart> depart,String userId) {
Assert.notNull(departs, "depart must not be null.");
Assert.notNull(userId, "userId must not be null.");
// some code
}