1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46 package org.codehaus.groovy.ast;
47
48 import org.codehaus.groovy.ast.expr.*;
49 import org.codehaus.groovy.ast.stmt.*;
50 import org.objectweb.asm.Constants;
51
52 /***
53 * Represents a property (member variable, a getter and setter)
54 *
55 * @author <a href="mailto:james@coredevelopers.net">James Strachan</a>
56 * @version $Revision: 1.8 $
57 */
58 public class PropertyNode extends MetadataNode implements Constants {
59
60 private FieldNode field;
61 private Statement getterBlock;
62 private Statement setterBlock;
63 private int modifiers;
64
65 public PropertyNode(
66 String name,
67 int modifiers,
68 String type,
69 String owner,
70 Expression initialValueExpression,
71 Statement getterBlock,
72 Statement setterBlock) {
73 this(new FieldNode(name, modifiers & ACC_STATIC, type, owner, initialValueExpression), modifiers, getterBlock, setterBlock);
74 }
75
76 public PropertyNode(FieldNode field, int modifiers, Statement getterBlock, Statement setterBlock) {
77 this.field = field;
78 this.modifiers = modifiers;
79 this.getterBlock = getterBlock;
80 this.setterBlock = setterBlock;
81 }
82
83 public Statement getGetterBlock() {
84 return getterBlock;
85 }
86
87 public Expression getInitialValueExpression() {
88 return field.getInitialValueExpression();
89 }
90
91 public int getModifiers() {
92 return modifiers;
93 }
94
95 public String getName() {
96 return field.getName();
97 }
98
99 public Statement getSetterBlock() {
100 return setterBlock;
101 }
102
103 public String getType() {
104 return field.getType();
105 }
106
107 public boolean isDynamicType() {
108 return field.isDynamicType();
109 }
110
111 public FieldNode getField() {
112 return field;
113 }
114
115 public boolean isPrivate() {
116 return (modifiers & ACC_PRIVATE) != 0;
117 }
118
119 }