| Revision | 271 (tree) |
|---|---|
| Time | 2016-05-03 21:38:22 |
| Author | t_nakayama1971 |
(empty log message)
| @@ -14,6 +14,7 @@ | ||
| 14 | 14 | * See the License for the specific language governing permissions and |
| 15 | 15 | * limitations under the License. |
| 16 | 16 | */ |
| 17 | + | |
| 17 | 18 | package org.apache.commons.chain2.impl; |
| 18 | 19 | |
| 19 | 20 | import org.apache.commons.chain2.Context; |
| @@ -24,21 +25,20 @@ | ||
| 24 | 25 | /** |
| 25 | 26 | * Convenience base class for {@link Context} implementations. |
| 26 | 27 | * |
| 28 | + * @version $Id$ | |
| 27 | 29 | * @param <K> the type of keys maintained by the context associated with this context |
| 28 | 30 | * @param <V> the type of mapped values |
| 29 | 31 | * |
| 30 | 32 | * @since 2.0 |
| 31 | - * @version $Id$ | |
| 32 | 33 | */ |
| 33 | 34 | public class ContextMap<K, V> extends ConcurrentHashMap<K, V> implements Context<K, V> { |
| 34 | 35 | |
| 35 | - /** | |
| 36 | - * | |
| 37 | - */ | |
| 36 | + /** serialVersionUID */ | |
| 38 | 37 | private static final long serialVersionUID = 20120724L; |
| 39 | 38 | |
| 40 | 39 | /** |
| 41 | - * Creates a new, empty Context with a default initial capacity, load factor, and concurrencyLevel. | |
| 40 | + * Creates a new, empty Context with a default initial capacity, | |
| 41 | + * load factor, and concurrencyLevel. | |
| 42 | 42 | */ |
| 43 | 43 | public ContextMap() { |
| 44 | 44 | super(); |
| @@ -45,22 +45,25 @@ | ||
| 45 | 45 | } |
| 46 | 46 | |
| 47 | 47 | /** |
| 48 | - * Creates a new, empty Context with the specified initial capacity, and with default load factor and concurrencyLevel | |
| 48 | + * Creates a new, empty Context with the specified initial capacity, | |
| 49 | + * and with default load factor and concurrencyLevel | |
| 49 | 50 | * |
| 50 | 51 | * @param initialCapacity the initial capacity. |
| 51 | 52 | */ |
| 52 | - public ContextMap(int initialCapacity) { | |
| 53 | + public ContextMap(final int initialCapacity) { | |
| 53 | 54 | super(initialCapacity); |
| 54 | 55 | } |
| 55 | 56 | |
| 56 | 57 | /** |
| 57 | - * Creates a new, empty Context with the specified initial capacity, load factor, and concurrency level. | |
| 58 | + * Creates a new, empty Context with the specified initial capacity, | |
| 59 | + * load factor, and concurrency level. | |
| 58 | 60 | * |
| 59 | 61 | * @param initialCapacity the initial capacity. |
| 60 | 62 | * @param loadFactor the load factor threshold, used to control resizing. |
| 61 | 63 | * @param concurrencyLevel the estimated number of concurrently updating threads. |
| 62 | 64 | */ |
| 63 | - public ContextMap(int initialCapacity, float loadFactor, int concurrencyLevel) { | |
| 65 | + public ContextMap(final int initialCapacity, | |
| 66 | + final float loadFactor, final int concurrencyLevel) { | |
| 64 | 67 | super(initialCapacity, loadFactor, concurrencyLevel); |
| 65 | 68 | } |
| 66 | 69 |
| @@ -69,7 +72,7 @@ | ||
| 69 | 72 | * |
| 70 | 73 | * @param t Map whose key-value pairs are added |
| 71 | 74 | */ |
| 72 | - public ContextMap(Map<? extends K, ? extends V> t) { | |
| 75 | + public ContextMap(final Map<? extends K, ? extends V> t) { | |
| 73 | 76 | super(t); |
| 74 | 77 | } |
| 75 | 78 | /** |
| @@ -76,13 +79,12 @@ | ||
| 76 | 79 | * {@inheritDoc} |
| 77 | 80 | */ |
| 78 | 81 | @Override |
| 79 | - public <T extends V> T retrieve(K key) { | |
| 82 | + public <T extends V> T retrieve(final K key) { | |
| 80 | 83 | V valueObject = get(key); |
| 81 | 84 | if (valueObject == null) { |
| 82 | 85 | return null; |
| 83 | 86 | } |
| 84 | 87 | // will throw ClassCastException if type are not assignable anyway |
| 85 | - @SuppressWarnings("unchecked") | |
| 86 | 88 | T value = (T) valueObject; |
| 87 | 89 | return value; |
| 88 | 90 | } |