...新的 Engine 并将它赋给了变量 _engine)。 明天:Engine 类创建起来变得代价很高,所以你决定使用延迟初始化 (lazily initialize),在第一次调用 Engine 的 getter 方法时才初始化 Engine (这是很好的)。
基于4个网页-相关网页
By using Wicket's TestPanelSource class we can lazily initialize a given panel for testing purposes.
借助于Wicket的TestPanelSource类,我们可以根据测试需要延迟初始化给定的面板。
I want to lazily initialize the new services, only if needed, and when it is initialized, I want to set all the parameters I mentioned above.
我只想懒洋洋地初始化新服务,如果需要,而在初始化时,我想我上面提到的设置所有参数。
With singletons implemented as single instances instead of static class members, you can initialize the singleton lazily, creating it only when it is first used.
由于单例对象作为实例存在而不是类的静态成员,所以你能够惰性地初始化单例对象,即只需要在第一次用它的时候才去创建它。
应用推荐