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

Interface GroovyObject

src/main/java/groovy/lang/GroovyObject.java:28–77  ·  view source on GitHub ↗

The interface implemented by all Groovy objects. Especially handy for using Groovy objects when in the Java world.

Source from the content-addressed store, hash-verified

26 * Especially handy for using Groovy objects when in the Java world.
27 */
28public interface GroovyObject {
29
30 /**
31 * Invokes the given method.
32 *
33 * @param name the name of the method to call
34 * @param args the arguments to use for the method call
35 * @return the result of invoking the method
36 */
37 @Internal // marked as internal just for backward compatibility, e.g. AbstractCallSite.createGroovyObjectGetPropertySite will check `isMarkedInternal`
38 default Object invokeMethod(String name, Object args) {
39 return getMetaClass().invokeMethod(this, name, args);
40 }
41
42 /**
43 * Retrieves a property value.
44 *
45 * @param propertyName the name of the property of interest
46 * @return the given property
47 */
48 @Internal // marked as internal just for backward compatibility, e.g. AbstractCallSite.createGroovyObjectGetPropertySite will check `isMarkedInternal`
49 default Object getProperty(String propertyName) {
50 return getMetaClass().getProperty(this, propertyName);
51 }
52
53 /**
54 * Sets the given property to the new value.
55 *
56 * @param propertyName the name of the property of interest
57 * @param newValue the new value for the property
58 */
59 @Internal // marked as internal just for backward compatibility, e.g. AbstractCallSite.createGroovyObjectGetPropertySite will check `isMarkedInternal`
60 default void setProperty(String propertyName, Object newValue) {
61 getMetaClass().setProperty(this, propertyName, newValue);
62 }
63
64 /**
65 * Returns the metaclass for a given class.
66 *
67 * @return the metaClass of this instance
68 */
69 MetaClass getMetaClass();
70
71 /**
72 * Allows the MetaClass to be replaced with a derived implementation.
73 *
74 * @param metaClass the new metaclass
75 */
76 void setMetaClass(MetaClass metaClass);
77}

Callers 27

doCallMethod · 0.95
createTemplateClosureMethod · 0.95
GStringTemplateMethod · 0.95
testTreeMethod · 0.95
testVerboseTreeMethod · 0.95
testSmallTreeMethod · 0.95
testLittleClosureMethod · 0.95
testNestedClosureBugMethod · 0.95
doCallMethod · 0.95
testPropertyMethod · 0.95
testPropertyMethod · 0.95
testCompileMethod · 0.95

Implementers 7

Tt1cgisrc/test/groovy/gls/ch06/s05/testClass
Tt1gisrc/test/groovy/gls/ch06/s05/testClass
Sequencesrc/main/java/groovy/lang/Sequence.jav
DelegatingMetaClasssrc/main/java/groovy/lang/DelegatingMe
ExpandoMetaClasssrc/main/java/groovy/lang/ExpandoMetaC
GroovyObjectSupportsrc/main/java/groovy/lang/GroovyObject
Wrappersrc/main/java/org/codehaus/groovy/runt

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…