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

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

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

MetaClass.invokeStaticMethod介绍

暂无

代码示例

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

public Object call() {
    return adaptee.invokeStaticMethod(object, methodName, arguments);
  }
});

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

public Object invokeStaticMethod(Object object, String methodName, Object[] arguments) {
  return delegate.invokeStaticMethod(object, methodName, arguments);
}

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

public Object invokeStaticMethod(final Object object, final String methodName, final Object[] arguments) {
  if (null == interceptor && !fallingThrough) {
    throw new RuntimeException("cannot invoke static method '" + methodName + "' without interceptor");
  }
  Object result = FALL_THROUGH_MARKER;
  if (interceptor != null) {
    result = interceptor.beforeInvoke(object, methodName, arguments);
  }
  if (result == FALL_THROUGH_MARKER) {
    Interceptor saved = interceptor;
    interceptor = null;
    boolean savedFallingThrough = fallingThrough;
    fallingThrough = true;
    result = adaptee.invokeStaticMethod(object, methodName, arguments);
    fallingThrough = savedFallingThrough;
    interceptor = saved;
  }
  return result;
}

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

public Object invokeStaticMethod(Object object, String methodName, Object[] arguments) {
  final Object owner = getOwner();
  final MetaClass ownerMetaClass = getOwnerMetaClass(owner);
  return ownerMetaClass.invokeStaticMethod(object, methodName, arguments);
}

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

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

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

public final Object call(Object receiver, Object[] args) throws Throwable {
  if (checkCall(receiver)) {
    try {
      return metaClass.invokeStaticMethod(receiver, name, args);
    } catch (GroovyRuntimeException gre) {
      throw ScriptBytecodeAdapter.unwrap(gre);
    }
  } else {
    return CallSiteArray.defaultCall(this, receiver, args);
  }
}

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

public final Object callStatic(Class receiver, Object[] args) throws Throwable {
    if (checkCall(receiver)) {
      try {
        return metaClass.invokeStaticMethod(receiver, name, args);
      } catch (GroovyRuntimeException gre) {
        throw ScriptBytecodeAdapter.unwrap(gre);
      }
    } else {
      return CallSiteArray.defaultCallStatic(this, receiver, args);
    }
  }
}

代码示例来源: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.codehaus.groovy/groovy

/**
 * Invokes the given method on the object.
 */
public static Object invokeMethod(Object object, String methodName, Object arguments) {
  if (object == null) {
    object = NullObject.getNullObject();
    //throw new NullPointerException("Cannot invoke method " + methodName + "() on null object");
  }
  // if the object is a Class, call a static method from that class
  if (object instanceof Class) {
    Class theClass = (Class) object;
    MetaClass metaClass = metaRegistry.getMetaClass(theClass);
    return metaClass.invokeStaticMethod(object, methodName, asArray(arguments));
  }
  // it's an instance; check if it's a Java one
  if (!(object instanceof GroovyObject)) {
    return invokePojoMethod(object, methodName, arguments);
  }
  // a groovy instance (including builder, closure, ...)
  return invokePogoMethod(object, methodName, arguments);
}

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

if (sender != theClass) {
  MetaClass mc = registry.getMetaClass(sender);
  return mc.invokeStaticMethod(sender, methodName, arguments);

代码示例来源:origin: org.gmock/gmock

public Object call() {
    return adaptee.invokeStaticMethod(clazz, method, arguments);
  }
}, new Callable() {

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

public Object invokeStaticMethod(Object object, String methodName, Object[] arguments) {
  final Object owner = getOwner();
  final MetaClass ownerMetaClass = getOwnerMetaClass(owner);
  return ownerMetaClass.invokeStaticMethod(object, methodName, arguments);
}

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

public Object invokeStaticMethod(Object object, String methodName, Object[] arguments) {
  final Object owner = getOwner();
  final MetaClass ownerMetaClass = getOwnerMetaClass(owner);
  return ownerMetaClass.invokeStaticMethod(object, methodName, arguments);
}

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

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

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

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

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

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

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

public final Object call(Object receiver, Object[] args) throws Throwable {
  if (checkCall(receiver)) {
    try {
      return metaClass.invokeStaticMethod(receiver, name, args);
    } catch (GroovyRuntimeException gre) {
      throw ScriptBytecodeAdapter.unwrap(gre);
    }
  } else {
    return CallSiteArray.defaultCall(this, receiver, args);
  }
}

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

public final Object callStatic(Class receiver, Object[] args) throws Throwable {
    if (checkCall(receiver)) {
      try {
        return metaClass.invokeStaticMethod(receiver, name, args);
      } catch (GroovyRuntimeException gre) {
        throw ScriptBytecodeAdapter.unwrap(gre);
      }
    } else {
      return CallSiteArray.defaultCallStatic(this, receiver, args);
    }
  }
}

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

public final Object call(Object receiver, Object[] args) throws Throwable {
  if (checkCall(receiver)) {
    try {
      return metaClass.invokeStaticMethod(receiver, name, args);
    } catch (GroovyRuntimeException gre) {
      throw ScriptBytecodeAdapter.unwrap(gre);
    }
  } else {
    return CallSiteArray.defaultCall(this, receiver, args);
  }
}

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

public final Object callStatic(Class receiver, Object[] args) throws Throwable {
    if (checkCall(receiver)) {
      try {
        return metaClass.invokeStaticMethod(receiver, name, args);
      } catch (GroovyRuntimeException gre) {
        throw ScriptBytecodeAdapter.unwrap(gre);
      }
    } else {
      return CallSiteArray.defaultCallStatic(this, receiver, args);
    }
  }
}

相关文章