View Javadoc
1   package com.atlassian.plugin.descriptors;
2   
3   import com.atlassian.plugin.ModuleDescriptor;
4   import com.atlassian.plugin.PluginParseException;
5   import com.atlassian.plugin.module.ModuleFactory;
6   
7   abstract class AbstractNoOpModuleDescriptor<T> extends AbstractModuleDescriptor<T> {
8       private String errorText;
9   
10      protected AbstractNoOpModuleDescriptor() {
11          super(new ModuleFactory() {
12              @Override
13              public <T> T createModule(String name, ModuleDescriptor<T> moduleDescriptor) throws PluginParseException {
14                  throw new IllegalStateException("The module is either unloadable or unrecognised, in any case this shouldn't be called!");
15              }
16          });
17      }
18  
19      public final String getErrorText() {
20          return errorText;
21      }
22  
23      public final void setErrorText(final String errorText) {
24          this.errorText = errorText;
25      }
26  
27      @Override
28      public final T getModule() {
29          return null;
30      }
31  
32      @Override
33      public final boolean isEnabledByDefault() {
34          return false;
35      }
36  
37      /**
38       * Sets the key of the ModuleDescriptor
39       *
40       * This is theoretically bad, as the superclass and the interface doesn't define this method,
41       * but it's required to construct an module descriptor when we don't have the XML Element.
42       *
43       * @param key the key of the ModuleDescriptor
44       */
45      public final void setKey(final String key) {
46          this.key = key;
47      }
48  
49      /**
50       * Sets the name of the ModuleDescriptor
51       *
52       * This is theoretically bad, as the superclass and the interface doesn't define this method,
53       * but it's required to construct an module descriptor when we don't have the XML Element.
54       *
55       * @param name the name of the ModuleDescriptor
56       */
57      public final void setName(final String name) {
58          this.name = name;
59      }
60  }