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

Class GroovyObjectSupport

src/main/java/groovy/lang/GroovyObjectSupport.java:29–50  ·  view source on GitHub ↗

Base class for Java objects wishing to be Groovy objects.

Source from the content-addressed store, hash-verified

27 * Base class for Java objects wishing to be Groovy objects.
28 */
29public abstract class GroovyObjectSupport implements GroovyObject {
30
31 // never persist the MetaClass
32 private transient MetaClass metaClass = getDefaultMetaClass();
33
34 /** {@inheritDoc} */
35 @Override
36 @Transient
37 public MetaClass getMetaClass() {
38 return this.metaClass;
39 }
40
41 /** {@inheritDoc} */
42 @Override
43 public void setMetaClass(/*@Nullable*/ final MetaClass metaClass) {
44 this.metaClass = Optional.ofNullable(metaClass).orElseGet(this::getDefaultMetaClass);
45 }
46
47 private MetaClass getDefaultMetaClass() {
48 return InvokerHelper.getMetaClass(this.getClass());
49 }
50}

Callers

nothing calls this directly

Calls 1

getDefaultMetaClassMethod · 0.95

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…