View Javadoc

1   /*
2    * $Id: RegistryMap.java 17843 2010-07-03 22:08:57Z rossmason $
3    * --------------------------------------------------------------------------------------
4    * Copyright (c) MuleSoft, Inc.  All rights reserved.  http://www.mulesoft.com
5    *
6    * The software in this package is published under the terms of the CPAL v1.0
7    * license, a copy of which has been included with this distribution in the
8    * LICENSE.txt file.
9    */
10  package org.mule.registry;
11  
12  import org.mule.api.registry.Registry;
13  import org.mule.util.CaseInsensitiveHashMap;
14  
15  import java.util.Map;
16  
17  /**
18   * Provides a {@link java.util.HashMap} view of values stored in the registry
19   */
20  public class RegistryMap extends CaseInsensitiveHashMap
21  {
22      private Registry registry;
23  
24      public RegistryMap(Registry registry)
25      {
26          this.registry = registry;
27      }
28  
29      public RegistryMap(int i, Registry registry)
30      {
31          super(i);
32          this.registry = registry;
33      }
34  
35      public RegistryMap(int i, float v, Registry registry)
36      {
37          super(i, v);
38          this.registry = registry;
39      }
40  
41      public RegistryMap(Map map, Registry registry)
42      {
43          super(map);
44          this.registry = registry;
45      }
46  
47      public Object get(Object key)
48      {
49          Object val = super.get(key);
50          if (val == null)
51          {
52              val = registry.lookupObject(key.toString());
53          }
54          return val;
55      }
56  }