View Javadoc

1   /*
2    * $Id: DescriptorContainerKeyPair.java 7963 2007-08-21 08:53:15Z dirk.olmes $
3    * --------------------------------------------------------------------------------------
4    * Copyright (c) MuleSource, Inc.  All rights reserved.  http://www.mulesource.com
5    *
6    * The software in this package is published under the terms of the CPAL v1.0
7    * license, a copy of which has been included with this distribution in the
8    * LICENSE.txt file.
9    */
10  
11  package org.mule.impl.container;
12  
13  public class DescriptorContainerKeyPair extends ContainerKeyPair
14  {
15      private String descriptorName;
16  
17      public DescriptorContainerKeyPair(String descriptorName, Object key)
18      {
19          super(DescriptorContainerContext.DESCRIPTOR_CONTAINER_NAME, key);
20          this.descriptorName = descriptorName;
21      }
22  
23      public String getDescriptorName()
24      {
25          return descriptorName;
26      }
27  
28      public String toFullString()
29      {
30          return "Descriptor Container Key{name=" + descriptorName + ", key=" + getKey().toString()
31                          + ", container=" + getContainerName() + ", required=" + isRequired() + "}";
32      }
33  
34      public boolean equals(Object o)
35      {
36          if (this == o)
37          {
38              return true;
39          }
40          if (o == null || getClass() != o.getClass())
41          {
42              return false;
43          }
44          if (!super.equals(o))
45          {
46              return false;
47          }
48  
49          final DescriptorContainerKeyPair that = (DescriptorContainerKeyPair) o;
50  
51          if (descriptorName != null
52                          ? !descriptorName.equals(that.descriptorName) : that.descriptorName != null)
53          {
54              return false;
55          }
56  
57          return true;
58      }
59  
60      public int hashCode()
61      {
62          return 29 * super.hashCode() + (descriptorName != null ? descriptorName.hashCode() : 0);
63      }
64  }