View Javadoc

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