シングルトンオブジェクトのAssert.notNullは必要ですか?
私はクラスを持っています:
public class ComponentFactory {
private static LibraryFrame libraryFrame;
public static synchronized LibraryFrame getLibraryFrame() {
if (libraryFrame == null) {
libraryFrame = new LibraryFrame();
}
return libraryFrame;
}
}
今、それは次のように使用する必要があります:
LibraryFrame libraryFrame = ComponentFactory.getLibraryFrame();
Assert.notNull(libraryFrame);
// other part
ここで、Assertクラスはorg.springframework.util.Assertです。
アサーションが失敗した場合、失敗が発生した後にSystem.exit(0)を呼び出す方法はありますか?