Class Realm

java.lang.Object
org.apache.groovy.metaclass.Realm

@Incubating public final class Realm extends Object
A Realm is the representation of a metaclass layer in a tree of realm objects.
  • Method Details

    • newRealm

      public static Realm newRealm(String name, Realm parent)
      Creates a realm with the given name. A null parent is replaced by the root realm.

      A null name fails immediately.

      Parameters:
      name - realm name; must not be null
      parent - parent realm, or null to attach the new realm under the root
      Returns:
      the new realm
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • getMetaClass

      public <T> MetaClass<T> getMetaClass(Class<T> theClass)
      Returns a MetaClass whose constant is cached on this realm's ClassValue and re-read when that constant's SwitchPoint is invalidated.
      Type Parameters:
      T - the class the meta-class describes
      Parameters:
      theClass - the class to look up
      Returns:
      a meta-class bound to the cached constant for theClass