Coverage Report - org.trails.descriptor.TrailsMethodDescriptor
 
Classes in this File Line Coverage Branch Coverage Complexity
TrailsMethodDescriptor
90% 
N/A 
0
 
 1  
 package org.trails.descriptor;
 2  
 
 3  
 import java.lang.reflect.Method;
 4  
 
 5  
 public class TrailsMethodDescriptor extends TrailsDescriptor implements IMethodDescriptor
 6  
 {
 7  
 
 8  
         private String name;
 9  
         private Class beanType;
 10  
         private Class[] argumentTypes;
 11  
 
 12  
         /////////////////////////////////////////////////////////////////////////////////////////////////////////
 13  
         // constructors
 14  
         /////////////////////////////////////////////////////////////////////////////////////////////////////////
 15  
         public TrailsMethodDescriptor(IMethodDescriptor methodDescriptor)
 16  
         {
 17  4
                 super(methodDescriptor);
 18  4
         }
 19  
 
 20  
         public TrailsMethodDescriptor(Class beanType, String name, Class returnType, Class[] argumentTypes)
 21  
         {
 22  3412
                 super(returnType);
 23  3412
                 this.beanType = beanType;
 24  3412
                 this.name = name;
 25  3412
                 this.argumentTypes = argumentTypes;
 26  3412
                 setHidden(true);
 27  3412
         }
 28  
 
 29  
         /////////////////////////////////////////////////////////////////////////////////////////////////////////
 30  
         // bean setters/getters
 31  
         /////////////////////////////////////////////////////////////////////////////////////////////////////////
 32  
 
 33  
         /**
 34  
          * (non-Javadoc)
 35  
          *
 36  
          * @see org.trails.descriptor.IMethodDescriptor#getArgumentTypes()
 37  
          */
 38  
 
 39  
         public Class[] getArgumentTypes()
 40  
         {
 41  4
                 return argumentTypes;
 42  
         }
 43  
 
 44  
 
 45  
         /**
 46  
          * just for serialization pourposes
 47  
          */
 48  
         public void setArgumentTypes(Class[] argumentTypes)
 49  
         {
 50  4
                 this.argumentTypes = argumentTypes;
 51  4
         }
 52  
 
 53  
 
 54  
         /**
 55  
          * (non-Javadoc)
 56  
          *
 57  
          * @see org.trails.descriptor.IMethodDescriptor#getName()
 58  
          */
 59  
         public String getName()
 60  
         {
 61  4
                 return name;
 62  
         }
 63  
 
 64  
 
 65  
         /**
 66  
          * just for serialization pourposes
 67  
          */
 68  
         public void setName(String name)
 69  
         {
 70  4
                 this.name = name;
 71  4
         }
 72  
 
 73  
         public Class getBeanType()
 74  
         {
 75  4
                 return beanType;
 76  
         }
 77  
 
 78  
         /**
 79  
          * just for serialization pourposes
 80  
          */
 81  
         public void setBeanType(Class beanType)
 82  
         {
 83  4
                 this.beanType = beanType;
 84  4
         }
 85  
 
 86  
         public Method getMethod()
 87  
         {
 88  
                 try
 89  
                 {
 90  4
                         return beanType.getMethod(name, argumentTypes);
 91  0
                 } catch (NoSuchMethodException e)
 92  
                 {
 93  0
                         return null;
 94  
                 }
 95  
         }
 96  
 
 97  
         @Override
 98  
         public Object clone()
 99  
         {
 100  4
                 return new TrailsMethodDescriptor(this);
 101  
         }
 102  
 }