groovy.lang.MetaClass.invokeConstructor()方法的使用及代码示例

x33g5p2x  于2022-01-25 转载在 其他  
字(6.1k)|赞(0)|评价(0)|浏览(124)

本文整理了Java中groovy.lang.MetaClass.invokeConstructor()方法的一些代码示例,展示了MetaClass.invokeConstructor()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。MetaClass.invokeConstructor()方法的具体详情如下:
包路径:groovy.lang.MetaClass
类名称:MetaClass
方法名:invokeConstructor

MetaClass.invokeConstructor介绍

暂无

代码示例

代码示例来源:origin: org.codehaus.groovy/groovy

public Object call() {
    return adaptee.invokeConstructor(arguments);
  }
});

代码示例来源:origin: org.codehaus.groovy/groovy

public Object invokeConstructor(Object[] arguments) {
  return delegate.invokeConstructor(arguments);
}

代码示例来源:origin: org.codehaus.groovy/groovy

public Object invokeConstructor(Object[] arguments) {
  final Object owner = getOwner();
  final MetaClass ownerMetaClass = getOwnerMetaClass(owner);
  return ownerMetaClass.invokeConstructor(arguments);
}

代码示例来源:origin: groovy/groovy-core

/**
 * Unlike general impl in superclass, ctors are not intercepted but relayed
 * unless interceptConstruction is set.
 */
public Object invokeConstructor(final Object[] arguments) {
  if (interceptConstruction && null == interceptor)
    throw new RuntimeException("cannot invoke constructor without interceptor");
  if (interceptConstruction) {
    GroovyObject newInstance = (GroovyObject) interceptor.beforeInvoke(null, getTheClass().getSimpleName(), arguments);
    newInstance.setMetaClass(this);
    return newInstance;
  }
  return adaptee.invokeConstructor(arguments);
}

代码示例来源:origin: org.codehaus.groovy/groovy

public static Object invokeConstructorOf(Class type, Object arguments) {
  MetaClass metaClass = metaRegistry.getMetaClass(type);
  return metaClass.invokeConstructor(asArray(arguments));
}

代码示例来源:origin: org.codehaus.groovy/groovy

public Object callConstructor(Object receiver, Object[] args) throws Throwable {
    if (receiver == metaClass.getTheClass()) {
      try {
        return metaClass.invokeConstructor(args);
      } catch (GroovyRuntimeException gre) {
        throw ScriptBytecodeAdapter.unwrap(gre);
      }
    } else {
     return CallSiteArray.defaultCallConstructor(this, (Class)receiver, args);
    }
  }
}

代码示例来源:origin: org.codehaus.groovy/groovy

public Object callConstructor(Object receiver, Object[] args) throws Throwable {
    try {
      if (receiver == metaClass.getTheClass()
        && version == classInfo.getVersion()) // metaClass still be valid
        return metaClass.invokeConstructor(args);
      else
       return CallSiteArray.defaultCallConstructor(this, receiver, args);
    } catch (GroovyRuntimeException gre) {
      throw ScriptBytecodeAdapter.unwrap(gre);
    }
  }
}

代码示例来源:origin: spockframework/spock

@Override
 public Object respond(IMockInvocation invocation) {
  Object instance = invocation.getMockObject().getInstance();
  Object[] arguments = invocation.getArguments().toArray();
  if (invocation.getMethod().isStatic()) {
   if ("<init>".equals(invocation.getMethod().getName())) {
    return metaClass.invokeConstructor(arguments);
   }
   return metaClass.invokeStaticMethod(instance, invocation.getMethod().getName(), arguments);
  }
  return metaClass.invokeMethod(instance, invocation.getMethod().getName(), arguments);
 }
}

代码示例来源:origin: org.kohsuke.droovy/groovy

/**
 * Unlike general impl in superclass, ctors are not intercepted but relayed
 */
public Object invokeConstructor(final Object[] arguments) {
  return adaptee.invokeConstructor(arguments);
}

代码示例来源:origin: org.codehaus.groovy/groovy-all-minimal

/**
 * Unlike general impl in superclass, ctors are not intercepted but relayed
 */
public Object invokeConstructor(final Object[] arguments) {
  return adaptee.invokeConstructor(arguments);
}

代码示例来源:origin: org.codehaus.groovy/groovy-jdk14

/**
 * Unlike general impl in superclass, ctors are not intercepted but relayed
 */
public Object invokeConstructor(final Object[] arguments) {
  return adaptee.invokeConstructor(arguments);
}

代码示例来源:origin: org.codehaus.groovy/groovy-all-minimal

public Object call() {
    return adaptee.invokeConstructor(arguments);
  }
});

代码示例来源:origin: org.kohsuke.droovy/groovy

public Object invokeConstructor(Object[] arguments) {
  final Object owner = getOwner();
  final MetaClass ownerMetaClass = getOwnerMetaClass(owner);
  return ownerMetaClass.invokeConstructor(arguments);
}

代码示例来源:origin: org.codehaus.groovy/groovy-jdk14

public Object invokeConstructor(Object[] arguments) {
  final Object owner = getOwner();
  final MetaClass ownerMetaClass = getOwnerMetaClass(owner);
  return ownerMetaClass.invokeConstructor(arguments);
}

代码示例来源:origin: org.codehaus.groovy/groovy-all-minimal

/**
 * @deprecated
 */
public Object invokeConstructorOf(Class type, Object arguments) {
  MetaClass metaClass = metaRegistry.getMetaClass(type);
  return metaClass.invokeConstructor(asArray(arguments));
}

代码示例来源:origin: com.thinkaurelius.groovy-shaded-asm/groovy-shaded-asm

public Object invokeConstructor(Object[] arguments) {
  final Object owner = getOwner();
  final MetaClass ownerMetaClass = getOwnerMetaClass(owner);
  return ownerMetaClass.invokeConstructor(arguments);
}

代码示例来源:origin: com.thinkaurelius.groovy-shaded-asm/groovy-shaded-asm

public Object callConstructor(Object receiver, Object[] args) throws Throwable {
    if (receiver == metaClass.getTheClass()) {
      try {
        return metaClass.invokeConstructor(args);
      } catch (GroovyRuntimeException gre) {
        throw ScriptBytecodeAdapter.unwrap(gre);
      }
    } else {
     return CallSiteArray.defaultCallConstructor(this, (Class)receiver, args);
    }
  }
}

代码示例来源:origin: org.codehaus.groovy/groovy-jdk14

public Object callConstructor(Object receiver, Object[] args) throws Throwable {
    if (receiver == metaClass.getTheClass()) {
      try {
        return metaClass.invokeConstructor(args);
      } catch (GroovyRuntimeException gre) {
        throw ScriptBytecodeAdapter.unwrap(gre);
      }
    } else {
     return CallSiteArray.defaultCallConstructor(this, (Class)receiver, args);
    }
  }
}

代码示例来源:origin: org.codehaus.groovy/groovy-jdk14

public Object callConstructor(Object receiver, Object[] args) throws Throwable {
    try {
      if (receiver == metaClass.getTheClass()
        && version == classInfo.getVersion()) // metaClass still be valid
        return metaClass.invokeConstructor(args);
      else
       return CallSiteArray.defaultCallConstructor(this, receiver, args);
    } catch (GroovyRuntimeException gre) {
      throw ScriptBytecodeAdapter.unwrap(gre);
    }
  }
}

代码示例来源:origin: com.thinkaurelius.groovy-shaded-asm/groovy-shaded-asm

public Object callConstructor(Object receiver, Object[] args) throws Throwable {
    try {
      if (receiver == metaClass.getTheClass()
        && version == classInfo.getVersion()) // metaClass still be valid
        return metaClass.invokeConstructor(args);
      else
       return CallSiteArray.defaultCallConstructor(this, receiver, args);
    } catch (GroovyRuntimeException gre) {
      throw ScriptBytecodeAdapter.unwrap(gre);
    }
  }
}

相关文章