View Javadoc
1   package com.atlassian.sal.core.pluginsettings;
2   
3   import com.atlassian.sal.api.pluginsettings.PluginSettings;
4   import com.atlassian.sal.core.util.Assert;
5   
6   /**
7    * PluginSettings implementation that delegates to another PluginSettings, adding a prefix to every key passed in
8    */
9   public class PrefixedPluginSettingsDelegate implements PluginSettings {
10      private final String prefix;
11      private final PluginSettings target;
12  
13      public PrefixedPluginSettingsDelegate(String prefix, PluginSettings target) {
14          Assert.notNull(prefix, "Prefix must not be null");
15          Assert.notNull(target, "Target must not be null");
16          this.prefix = prefix;
17          this.target = target;
18      }
19  
20      public Object get(String key) {
21          return target.get(prefix + key);
22      }
23  
24      public Object put(String key, Object value) {
25          return target.put(prefix + key, value);
26      }
27  
28      public Object remove(String key) {
29          return target.remove(prefix + key);
30      }
31  }