MCPcopy
hub / github.com/apache/groovy / getProperty

Method getProperty

src/main/java/groovy/lang/MetaBeanProperty.java:80–91  ·  view source on GitHub ↗

Gets the property of the given object. @param object which to be got @return the property of the given object @throws RuntimeException if the property could not be evaluated

(final Object object)

Source from the content-addressed store, hash-verified

78 * @throws RuntimeException if the property could not be evaluated
79 */
80 @Override
81 public Object getProperty(final Object object) {
82 MetaMethod getter = getGetter();
83 if (getter == null) {
84 if (getField() != null) {
85 return getField().getProperty(object);
86 }
87 //TODO: create a WriteOnlyException class?
88 throw new GroovyRuntimeException("Cannot read write-only property: " + name);
89 }
90 return getter.invoke(object, MetaClassHelper.EMPTY_ARRAY);
91 }
92
93 /**
94 * Sets the property on the given object to the new value.

Callers 1

invokeMissingPropertyMethod · 0.95

Calls 4

getGetterMethod · 0.95
getFieldMethod · 0.95
invokeMethod · 0.95
getPropertyMethod · 0.65

Tested by

no test coverage detected