1 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 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 } 120 | Popular Tags |