1 /* |
1 /* |
2 * Copyright (c) 2001, 2011, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 2001, 2012, Oracle and/or its affiliates. All rights reserved. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * |
4 * |
5 * This code is free software; you can redistribute it and/or modify it |
5 * This code is free software; you can redistribute it and/or modify it |
6 * under the terms of the GNU General Public License version 2 only, as |
6 * under the terms of the GNU General Public License version 2 only, as |
7 * published by the Free Software Foundation. Oracle designates this |
7 * published by the Free Software Foundation. Oracle designates this |
113 |
113 |
114 /** |
114 /** |
115 * The underlying map storing the data. |
115 * The underlying map storing the data. |
116 * We maintain the invariant that this table contains only |
116 * We maintain the invariant that this table contains only |
117 * mappings of the form |
117 * mappings of the form |
118 * Key<T> -> T or Key<T> -> Factory<T> */ |
118 * {@literal Key<T> -> T } |
|
119 * or |
|
120 * {@literal Key<T> -> Factory<T> } |
|
121 */ |
119 private Map<Key<?>,Object> ht = new HashMap<Key<?>,Object>(); |
122 private Map<Key<?>,Object> ht = new HashMap<Key<?>,Object>(); |
120 |
123 |
121 /** Set the factory for the key in this context. */ |
124 /** Set the factory for the key in this context. */ |
122 public <T> void put(Key<T> key, Factory<T> fac) { |
125 public <T> void put(Key<T> key, Factory<T> fac) { |
123 checkState(ht); |
126 checkState(ht); |