View Javadoc
1   package com.atlassian.plugin.parsers;
2   
3   import org.dom4j.CharacterData;
4   import org.dom4j.Element;
5   
6   import static com.google.common.base.Preconditions.checkNotNull;
7   import static com.google.common.base.Preconditions.checkState;
8   
9   /**
10   * Reads module information from a plugin descriptor.
11   *
12   * @since 3.0.0
13   */
14  public final class ModuleReader {
15      private final Element module;
16  
17      public ModuleReader(Element module) {
18          this.module = checkNotNull(module);
19          checkState(!(module instanceof CharacterData), "Module elements cannot be text nodes!");
20      }
21  
22      public String getType() {
23          return module.getName(); // note that's the xml element name, not the module name
24      }
25  }