|
|||||||||||||||||||
30 day Evaluation Version distributed via the Maven Jar Repository. Clover is not free. You have 30 days to evaluate it. Please visit http://www.thecortex.net/clover to obtain a licensed version of Clover | |||||||||||||||||||
Source file | Conditionals | Statements | Methods | TOTAL | |||||||||||||||
FieldDescriptor.java | 100% | 100% | 100% | 100% |
|
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 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 | 46 |
public FieldDescriptor( final String name,
|
46 |
final String type, |
|
47 |
final Attribute[] declaredAttributes, |
|
48 |
final Attribute[] attributes ) |
|
49 |
{ |
|
50 | 46 |
super( declaredAttributes, attributes );
|
51 | 46 |
if( null == name ) |
52 |
{ |
|
53 | 2 |
throw new NullPointerException( "name" ); |
54 |
} |
|
55 | 44 |
if( null == type ) |
56 |
{ |
|
57 | 2 |
throw new NullPointerException( "type" ); |
58 |
} |
|
59 |
|
|
60 | 42 |
m_name = name; |
61 | 42 |
m_type = type; |
62 |
} |
|
63 |
|
|
64 |
/**
|
|
65 |
* Return the name of the field.
|
|
66 |
*
|
|
67 |
* @return the name of the field.
|
|
68 |
*/
|
|
69 | 30 |
public String getName()
|
70 |
{ |
|
71 | 30 |
return m_name;
|
72 |
} |
|
73 |
|
|
74 |
/**
|
|
75 |
* Return the type of the field.
|
|
76 |
*
|
|
77 |
* @return the type of the field.
|
|
78 |
*/
|
|
79 | 22 |
public String getType()
|
80 |
{ |
|
81 | 22 |
return m_type;
|
82 |
} |
|
83 |
} |
|
84 |
|
|