Coverage Report - org.mule.util.scan.annotations.AnnotationInfo
 
Classes in this File Line Coverage Branch Coverage Complexity
AnnotationInfo
0%
0/35
0%
0/22
0
AnnotationInfo$NameValue
0%
0/18
0%
0/10
0
 
 1  
 /*
 2  
  * $Id: AnnotationInfo.java 20321 2010-11-24 15:21:24Z dfeist $
 3  
  * --------------------------------------------------------------------------------------
 4  
  * Copyright (c) MuleSoft, Inc.  All rights reserved.  http://www.mulesoft.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  
 package org.mule.util.scan.annotations;
 11  
 
 12  
 import java.util.ArrayList;
 13  
 import java.util.HashMap;
 14  
 import java.util.List;
 15  
 import java.util.Map;
 16  
 
 17  0
 public class AnnotationInfo
 18  
 {
 19  
     private String className;
 20  0
     private List<NameValue> params = new ArrayList<NameValue>();
 21  
 
 22  
     public List<NameValue> getParams()
 23  
     {
 24  0
         return params;
 25  
     }
 26  
 
 27  
     public Map<String, Object> getParamsAsMap()
 28  
     {
 29  0
         Map m = new HashMap(params.size());
 30  0
         for (NameValue param : params)
 31  
         {
 32  0
             m.put(param.name, param.value);
 33  
         }
 34  0
         return m;
 35  
     }
 36  
 
 37  
     public void setParams(List<NameValue> params)
 38  
     {
 39  0
         this.params = params;
 40  0
     }
 41  
 
 42  
     public String getClassName()
 43  
     {
 44  0
         return className;
 45  
     }
 46  
 
 47  
     public void setClassName(String className)
 48  
     {
 49  0
         this.className = className;
 50  0
     }
 51  
 
 52  
     public boolean equals(final Object o)
 53  
     {
 54  0
         if (this == o)
 55  
         {
 56  0
             return true;
 57  
         }
 58  0
         if (o == null || getClass() != o.getClass())
 59  
         {
 60  0
             return false;
 61  
         }
 62  
 
 63  0
         final AnnotationInfo that = (AnnotationInfo) o;
 64  
 
 65  0
         if (!className.equals(that.className))
 66  
         {
 67  0
             return false;
 68  
         }
 69  0
         if (params != null ? !params.equals(that.params) : that.params != null)
 70  
         {
 71  0
             return false;
 72  
         }
 73  
 
 74  0
         return true;
 75  
     }
 76  
 
 77  
     public int hashCode()
 78  
     {
 79  
         int result;
 80  0
         result = className.hashCode();
 81  0
         result = 31 * result + (params != null ? params.hashCode() : 0);
 82  0
         return result;
 83  
     }
 84  
 
 85  
     @Override
 86  
     public String toString()
 87  
     {
 88  0
         StringBuilder sb = new StringBuilder(params.size() * 20);
 89  0
         sb.append(className).append('(');
 90  0
         for (int i = 0; i < params.size(); i++)
 91  
         {
 92  0
             NameValue param = params.get(i);
 93  0
             sb.append(param.name).append('=').append(param.value);
 94  0
             if (i < params.size() - 1)
 95  
             {
 96  0
                 sb.append(',');
 97  
             } else
 98  
             {
 99  0
                 sb.append(')');
 100  
             }
 101  
         }
 102  0
         return sb.toString();
 103  
     }
 104  
 
 105  0
     public static class NameValue
 106  
     {
 107  
         public String name;
 108  
         public Object value;
 109  
 
 110  
         NameValue(final String name, final Object value)
 111  0
         {
 112  0
             this.name = name;
 113  0
             this.value = value;
 114  0
         }
 115  
 
 116  
         public boolean equals(final Object o)
 117  
         {
 118  0
             if (this == o)
 119  
             {
 120  0
                 return true;
 121  
             }
 122  0
             if (o == null || getClass() != o.getClass())
 123  
             {
 124  0
                 return false;
 125  
             }
 126  
 
 127  0
             final NameValue nameValue = (NameValue) o;
 128  
 
 129  0
             if (!name.equals(nameValue.name))
 130  
             {
 131  0
                 return false;
 132  
             }
 133  0
             if (!value.equals(nameValue.value))
 134  
             {
 135  0
                 return false;
 136  
             }
 137  
 
 138  0
             return true;
 139  
         }
 140  
 
 141  
         public int hashCode()
 142  
         {
 143  
             int result;
 144  0
             result = name.hashCode();
 145  0
             result = 31 * result + value.hashCode();
 146  0
             return result;
 147  
         }
 148  
 
 149  
         @Override
 150  
         public String toString()
 151  
         {
 152  0
             return String.format("%s=%s", name, value);
 153  
         }
 154  
     }
 155  
 }