View Javadoc

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