我使用该方法创建了以下类,该main
方法创建 的新实例Application
和 的实例ApplicationModel
,ApplicationView
并ApplicationController
为此特定的Application
.
public class Application
{
// Variables
private ApplicationSettings settings;
private ApplicationModel model;
private ApplicationView view;
private ApplicationController controller;
// Constructor
public Application()
{
settings = new ApplicationSettings();
model = new ApplicationModel();
view = new ApplicationView(model);
controller = new ApplicationController();
}
// Main method
public static void main(String[] args)
{
Application application = new Application();
}
// Getters for settings, model, view, controller for instance of Application
}
我知道,永远只有一个唯一的Application
.
我想在我的ApplicationModel
,ApplicationView
和ApplicationController
类中获取这个特定的实例。
这怎么可能?