/** * Creates a singleton. * * @param router event router for the document holding the object * @param container container in which the singleton is stored * @param valueTagName tag name of a value instance */ public static <V, I> DocumentBasedSingleton<V, I> create(DocEventRouter router, Doc.E container, String valueTagName, Factory<Doc.E, V, I> valueFactory) { DocumentBasedSingleton<V, I> singleton = new DocumentBasedSingleton<V, I>(router, container, valueTagName, valueFactory); router.addChildListener(container, singleton); return singleton; }