Patterns add Singleton java code