Class ConstructorMetaClassSite

All Implemented Interfaces:
CallSite

public class ConstructorMetaClassSite extends MetaClassSite
Call site that invokes a constructor through a MetaClass when the receiver is that meta class's class.
  • Constructor Details

    • ConstructorMetaClassSite

      public ConstructorMetaClassSite(CallSite site, MetaClass metaClass)
      Copies the parent site and the meta class used for construction.
      Parameters:
      site - the site whose name and index are copied
      metaClass - the meta class whose class this site accepts as the receiver
  • Method Details

    • callConstructor

      public Object callConstructor(Object receiver, Object[] args) throws Throwable
      Invokes the meta class constructor when receiver is that meta class's class. A GroovyRuntimeException is unwrapped. Any other receiver is handled by the default constructor call.
      Specified by:
      callConstructor in interface CallSite
      Overrides:
      callConstructor in class AbstractCallSite
      Parameters:
      receiver - the constructor's owner, as supplied by the caller
      args - the constructor arguments, in order
      Returns:
      the constructed object
      Throws:
      Throwable - when construction fails