View Javadoc

1   package com.atlassian.plugin.webresource;
2   
3   import org.apache.commons.lang.builder.EqualsBuilder;
4   import org.apache.commons.lang.builder.HashCodeBuilder;
5   import org.apache.commons.lang.builder.ToStringBuilder;
6   
7   /**
8    * Encapsulate the module complete key and version number string of the host plugin for a WebResource.
9    * 
10   * @since 2.12.5
11   */
12  class BatchedWebResourceDescriptor
13  {
14      private final String pluginVersion;
15      private final String completeKey;
16      
17      public BatchedWebResourceDescriptor(String pluginVersion, String completeKey)
18      {
19          this.pluginVersion = pluginVersion;
20          this.completeKey = completeKey;
21      }
22  
23      public String getPluginVersion()
24      {
25          return pluginVersion;
26      }
27  
28      public String getCompleteKey()
29      {
30          return completeKey;
31      }
32  
33      @Override
34      public boolean equals(Object obj)
35      {
36          if (obj == null)
37              return false;
38  
39          if (obj == this)
40              return true;
41  
42          if (!(obj instanceof BatchedWebResourceDescriptor))
43              return false;
44  
45          BatchedWebResourceDescriptor rhs = (BatchedWebResourceDescriptor) obj;
46          
47          return new EqualsBuilder().append(completeKey, rhs.completeKey).append(pluginVersion, rhs.pluginVersion).isEquals();
48      }
49      
50      @Override
51      public int hashCode()
52      {
53          return new HashCodeBuilder(71, 11).append(completeKey).append(pluginVersion).toHashCode();
54      }
55  
56      @Override
57      public String toString()
58      {
59          return new ToStringBuilder(this).append(completeKey).append(pluginVersion).toString();
60      }
61  }