Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(378)

Unified Diff: charted/lib/core/utils/object_factory.dart

Issue 1400473008: Roll Observatory packages and add a roll script (Closed) Base URL: git@github.com:dart-lang/observatory_pub_packages.git@master
Patch Set: Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « charted/lib/core/utils/namespace.dart ('k') | charted/lib/core/utils/rect.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: charted/lib/core/utils/object_factory.dart
diff --git a/charted/lib/core/utils/object_factory.dart b/charted/lib/core/utils/object_factory.dart
deleted file mode 100644
index 7ddab0763d453758bcf42b5ad0f193780445fb24..0000000000000000000000000000000000000000
--- a/charted/lib/core/utils/object_factory.dart
+++ /dev/null
@@ -1,40 +0,0 @@
-//
-// Copyright 2014 Google Inc. All rights reserved.
-//
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file or at
-// https://developers.google.com/open-source/licenses/bsd
-//
-
-part of charted.core.utils;
-
-typedef T ObjectCreator<T>();
-
-/// Provides a registry and factory service.
-///
-/// Registration:
-/// ObjectFactory.register(“type”, () => { new TypeCreator(); });
-///
-/// Usage:
-/// instance = ObjectFactory.create('type');
-class ObjectFactory<T> {
- Map<String, ObjectCreator<T>> _components = {};
-
- /// Register a component [creator] for [name].
- void register(String name, ObjectCreator<T> creator) {
- _components[name] = creator;
- }
-
- /// Create an instance for [name].
- T create(String name) {
- if (!_components.containsKey(name)) {
- throw new ArgumentError('Element $name not found in ComponentFactory');
- }
- var creator = _components[name],
- instance = creator();
- if (instance == null) {
- throw new ArgumentError('Component $name initialization failed.');
- }
- return instance;
- }
-}
« no previous file with comments | « charted/lib/core/utils/namespace.dart ('k') | charted/lib/core/utils/rect.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698