当我正要使用一个大约2岁的旧课时,我意识到它使用了旧的Springframework。新框架很难导航,我不需要其他任何东西。
该类是strtotime(AKA String to Time)的一个很好的实现。 https://github.com/collegeman/stringtotime/blob/master/src/main/java/com/clutch/dates/StringToTime.java
当然,当我去编译所有我得到的是NoClassDefFoundError occured : org/springframework/util/Assert
,即使我尝试包括一个旧的弹簧罐也没什么区别。
该类的唯一部分取决于它.util.Assert:
Assert.notNull(dateTimeString);
Assert.notNull(now);
Assert.notNull(simpleDateFormat);
是否有人知道以下内容:
谢谢!
答案 0 :(得分:4)
答案 1 :(得分:3)
Guava's Preconditions。 google-guava是您应用程序的绝佳补充。
Preconditions.checkNotNull
就是您所需要的。有重载版本允许您指定错误消息等。