1
2
3
4
5
6
7
8 package org.codehaus.metaclass.model;
9
10 import java.io.Serializable;
11
12 /***
13 * A descriptor that describes a Field. It contains information about; <ul>
14 * <li>name: the name of the field</li> <li>type: the type of the field</li>
15 * <li>modifiers: the access modifiers for the field</li> </ul>
16 *
17 * <p>Also associated with each field is a set of arbitrary Attributes that can
18 * be used to store extra information about method.</p>
19 *
20 * @author Peter Donald
21 * @author Doug Hagan
22 * @version $Revision: 1.11 $ $Date: 2003/12/11 08:41:50 $
23 */
24 public final class FieldDescriptor
25 extends FeatureDescriptor
26 implements Serializable
27 {
28 /*** Constant for empty set of fields. */
29 public static final FieldDescriptor[] EMPTY_SET = new FieldDescriptor[ 0 ];
30
31 /*** The name of the field. */
32 private final String m_name;
33
34 /*** The type of the field. */
35 private final String m_type;
36
37 /***
38 * Create a descriptor for a field.
39 *
40 * @param name the name of the field
41 * @param type the return type of the field
42 * @param declaredAttributes the declared attributes
43 * @param attributes any attributes associated with method
44 */
45 public FieldDescriptor( final String name,
46 final String type,
47 final Attribute[] declaredAttributes,
48 final Attribute[] attributes )
49 {
50 super( declaredAttributes, attributes );
51 if( null == name )
52 {
53 throw new NullPointerException( "name" );
54 }
55 if( null == type )
56 {
57 throw new NullPointerException( "type" );
58 }
59
60 m_name = name;
61 m_type = type;
62 }
63
64 /***
65 * Return the name of the field.
66 *
67 * @return the name of the field.
68 */
69 public String getName()
70 {
71 return m_name;
72 }
73
74 /***
75 * Return the type of the field.
76 *
77 * @return the type of the field.
78 */
79 public String getType()
80 {
81 return m_type;
82 }
83 }