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