MCPcopy Index your code
hub / github.com/apache/groovy / setProperty

Method setProperty

src/main/java/groovy/lang/Script.java:82–95  ·  view source on GitHub ↗

{@inheritDoc}

(String property, Object newValue)

Source from the content-addressed store, hash-verified

80
81 /** {@inheritDoc} */
82 @Override
83 public void setProperty(String property, Object newValue) {
84 if ("binding".equals(property)) {
85 setBinding((Binding) newValue);
86 } else if ("metaClass".equals(property)) {
87 setMetaClass((MetaClass) newValue);
88 } else if (!binding.hasVariable(property)
89 // GROOVY-9554: @Field adds setter
90 && hasSetterMethodFor(property)) {
91 super.setProperty(property, newValue);
92 } else {
93 binding.setVariable(property, newValue);
94 }
95 }
96
97 private boolean hasSetterMethodFor(String property) {
98 String setterName = GeneralUtils.getSetterName(property);

Callers 3

parseAndRunScriptMethod · 0.95
writeToMethod · 0.95
writeToMethod · 0.95

Calls 7

setBindingMethod · 0.95
hasSetterMethodForMethod · 0.95
equalsMethod · 0.65
setMetaClassMethod · 0.65
setPropertyMethod · 0.65
hasVariableMethod · 0.45
setVariableMethod · 0.45

Tested by

no test coverage detected