Represents a property (member variable, a getter and setter)
| 29 | * Represents a property (member variable, a getter and setter) |
| 30 | */ |
| 31 | public class PropertyNode extends AnnotatedNode implements Variable { |
| 32 | |
| 33 | private FieldNode field; |
| 34 | private int modifiers; |
| 35 | |
| 36 | private Statement getterBlock; |
| 37 | private Statement setterBlock; |
| 38 | private String getterName; |
| 39 | private String setterName; |
| 40 | |
| 41 | /** |
| 42 | * Creates a property node representing a Java property (field + getter/setter). |
| 43 | * The property is synthesized from a field name, type, and optionally initial value expression, |
| 44 | * with getter and setter blocks. |
| 45 | * |
| 46 | * @param name the property name |
| 47 | * @param modifiers ASM modifier flags (applied to the property, with static flag removed from field) |
| 48 | * @param type the property type as a {@link ClassNode} |
| 49 | * @param owner the {@link ClassNode} that declares this property |
| 50 | * @param initialValueExpression optional initial value expression |
| 51 | * @param getterBlock optional statement block for the getter method body |
| 52 | * @param setterBlock optional statement block for the setter method body |
| 53 | */ |
| 54 | public PropertyNode(final String name, final int modifiers, final ClassNode type, final ClassNode owner, final Expression initialValueExpression, final Statement getterBlock, final Statement setterBlock) { |
| 55 | this(new FieldNode(name, modifiers & ACC_STATIC, type, owner, initialValueExpression), modifiers, getterBlock, setterBlock); |
| 56 | } |
| 57 | |
| 58 | /** |
| 59 | * Creates a property node from an existing field and getter/setter blocks. |
| 60 | * This constructor allows properties to be built from pre-existing field definitions. |
| 61 | * |
| 62 | * @param field the {@link FieldNode} backing this property |
| 63 | * @param modifiers ASM modifier flags for the property |
| 64 | * @param getterBlock optional statement block for the getter method body |
| 65 | * @param setterBlock optional statement block for the setter method body |
| 66 | */ |
| 67 | public PropertyNode(final FieldNode field, final int modifiers, final Statement getterBlock, final Statement setterBlock) { |
| 68 | this.field = field; |
| 69 | this.modifiers = modifiers; |
| 70 | this.getterBlock = getterBlock; |
| 71 | this.setterBlock = setterBlock; |
| 72 | } |
| 73 | |
| 74 | /** |
| 75 | * Returns the backing field node for this property. |
| 76 | * |
| 77 | * @return the {@link FieldNode} associated with this property |
| 78 | */ |
| 79 | public FieldNode getField() { |
| 80 | return field; |
| 81 | } |
| 82 | |
| 83 | /** |
| 84 | * Sets the backing field node for this property. |
| 85 | * |
| 86 | * @param field the {@link FieldNode} to associate with this property |
| 87 | */ |
| 88 | public void setField(final FieldNode field) { |
nothing calls this directly
no outgoing calls
no test coverage detected
searching dependent graphs…