View Javadoc

1   package com.atlassian.plugin;
2   
3   import com.google.common.base.Objects;
4   
5   import javax.annotation.Nullable;
6   
7   import static com.google.common.base.Preconditions.checkNotNull;
8   
9   public final class PluginPermission
10  {
11      public final static PluginPermission ALL = new PluginPermission(Permissions.ALL_PERMISSIONS);
12  
13      private final String name;
14      private final InstallationMode installationMode;
15  
16      public PluginPermission(String name)
17      {
18          this(name, null);
19      }
20  
21      public PluginPermission(String name, @Nullable InstallationMode installationMode)
22      {
23          this.name = checkNotNull(name);
24          this.installationMode = installationMode;
25      }
26  
27      public String getName()
28      {
29          return name;
30      }
31  
32      public InstallationMode getInstallationMode()
33      {
34          return installationMode;
35      }
36  
37      @Override
38      public boolean equals(Object o)
39      {
40          if (this == o)
41          {
42              return true;
43          }
44  
45          if (o == null || getClass() != o.getClass())
46          {
47              return false;
48          }
49  
50          final PluginPermission that = (PluginPermission) o;
51          return Objects.equal(this.name, that.name);
52      }
53  
54      @Override
55      public int hashCode()
56      {
57          return Objects.hashCode(this.name);
58      }
59  }