View Javadoc

1   /*
2    * Copyright (C) The MetaClass Group. All rights reserved.
3    *
4    * This software is published under the terms of the Spice
5    * Software License version 1.1, a copy of which has been included
6    * with this distribution in the LICENSE.txt file.
7    */
8   package org.codehaus.metaclass.model;
9   
10  import java.io.Serializable;
11  
12  /***
13   * A descriptor that describes a parameter of a Method. It contains information
14   * about; <ul> <li>name: the name of the parameter. This name may be
15   * automatically constructed if descriptor is created via reflection.</li>
16   * <li>type: the type of the parameter</li> </ul>
17   *
18   * @author Peter Donald
19   * @version $Revision: 1.7 $ $Date: 2003/12/11 08:41:50 $
20   */
21  public final class ParameterDescriptor
22      implements Serializable
23  {
24      /*** The constant for Empty Set of parameters. */
25      public static final ParameterDescriptor[] EMPTY_SET = new ParameterDescriptor[ 0 ];
26  
27      /*** The name of the Parameter in source file. */
28      private final String m_name;
29  
30      /*** The class/interface of the Parameter. */
31      private final String m_type;
32  
33      /***
34       * Construct a descriptor for a parameter.
35       *
36       * @param name the name of the parameter
37       * @param type the type of the parameter
38       */
39      public ParameterDescriptor( final String name,
40                                  final String type )
41      {
42          if( null == name )
43          {
44              throw new NullPointerException( "name" );
45          }
46          if( null == type )
47          {
48              throw new NullPointerException( "type" );
49          }
50  
51          m_name = name;
52          m_type = type;
53      }
54  
55      /***
56       * Return the name of the parameter.
57       *
58       * @return the name of the parameter.
59       */
60      public String getName()
61      {
62          return m_name;
63      }
64  
65      /***
66       * Return the type of the parameter.
67       *
68       * @return the type of the parameter.
69       */
70      public String getType()
71      {
72          return m_type;
73      }
74  }