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