View Javadoc
1   package com.atlassian.plugin.osgi.hostcomponents.impl;
2   
3   import com.atlassian.plugin.osgi.hostcomponents.ContextClassLoaderStrategy;
4   import com.atlassian.plugin.osgi.hostcomponents.PropertyBuilder;
5   
6   /**
7    * Default property builder for host components
8    */
9   class DefaultPropertyBuilder implements PropertyBuilder {
10      private Registration registration;
11  
12      public DefaultPropertyBuilder(Registration registration) {
13          this.registration = registration;
14      }
15  
16      @Override
17      public PropertyBuilder withName(String name) {
18          return withProperty(BEAN_NAME, name);
19      }
20  
21      @Override
22      public PropertyBuilder withContextClassLoaderStrategy(ContextClassLoaderStrategy strategy) {
23          return withProperty(CONTEXT_CLASS_LOADER_STRATEGY, strategy.name());
24      }
25  
26      @Override
27      public PropertyBuilder withTrackBundleEnabled(boolean enabled) {
28          return withProperty(TRACK_BUNDLE, Boolean.toString(enabled));
29      }
30  
31      @Override
32      public PropertyBuilder withProperty(String name, String value) {
33          registration.getProperties().put(name, value);
34          return this;
35      }
36  }