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