Coverage Report - org.mule.impl.container.ContainerKeyPair
 
Classes in this File Line Coverage Branch Coverage Complexity
ContainerKeyPair
0%
0/26
0%
0/4
1.889
 
 1  
 /*
 2  
  * $Id: ContainerKeyPair.java 7976 2007-08-21 14:26:13Z 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  
 /**
 14  
  * <code>ContainerKeyPair</code> is a key strategy that binds a container reference
 15  
  * with a container name. This object isn't used directly by users, but it is used
 16  
  * when the the Mule XML configuration is processed.
 17  
  */
 18  
 public class ContainerKeyPair
 19  
 {
 20  
     private final String containerName;
 21  
     private final Object key;
 22  
     private final boolean required;
 23  
 
 24  
     public ContainerKeyPair(String containerName, Object key)
 25  0
     {
 26  0
         this.containerName = containerName;
 27  0
         this.key = key;
 28  0
         this.required = true;
 29  0
     }
 30  
 
 31  
     public ContainerKeyPair(String containerName, Object key, boolean required)
 32  0
     {
 33  0
         this.containerName = containerName;
 34  0
         this.key = key;
 35  0
         this.required = required;
 36  0
     }
 37  
 
 38  
     public String getContainerName()
 39  
     {
 40  0
         return containerName;
 41  
     }
 42  
 
 43  
     public Object getKey()
 44  
     {
 45  0
         return key;
 46  
     }
 47  
 
 48  
     public boolean isRequired()
 49  
     {
 50  0
         return required;
 51  
     }
 52  
 
 53  
     // here we only return the key value as string so that
 54  
     // containers that have no notion of this object can still
 55  
     // look up objects by calling the toString method on this object
 56  
     public String toString()
 57  
     {
 58  0
         return key.toString();
 59  
     }
 60  
 
 61  
     public String toFullString()
 62  
     {
 63  0
         return "Container Key{key=" + key.toString() + ", container=" + containerName + ", required="
 64  
                + required + "}";
 65  
     }
 66  
 
 67  
     public boolean equals(Object o)
 68  
     {
 69  0
         if (this == o)
 70  
         {
 71  0
             return true;
 72  
         }
 73  0
         if (o == null || getClass() != o.getClass())
 74  
         {
 75  0
             return false;
 76  
         }
 77  
 
 78  0
         final ContainerKeyPair that = (ContainerKeyPair) o;
 79  
 
 80  0
         if (!containerName.equals(that.containerName))
 81  
         {
 82  0
             return false;
 83  
         }
 84  0
         if (!key.equals(that.key))
 85  
         {
 86  0
             return false;
 87  
         }
 88  
 
 89  0
         return true;
 90  
     }
 91  
 
 92  
     public int hashCode()
 93  
     {
 94  0
         return 29 * containerName.hashCode() + key.hashCode();
 95  
     }
 96  
 }