org.mozilla.javascript.ScriptableObject.callMethod()方法的使用及代码示例

x33g5p2x  于2022-01-30 转载在 JavaScript  
字(6.3k)|赞(0)|评价(0)|浏览(212)

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

ScriptableObject.callMethod介绍

[英]Call a method of an object.
[中]调用对象的方法。

代码示例

代码示例来源:origin: fr.avianey.apache-xmlgraphics/batik

public Object run(Context cx) {
    ScriptableObject.callMethod
      (scriptable, HANDLE_EVENT, array);
    return null;
  }
};

代码示例来源:origin: org.apache.xmlgraphics/batik-bridge

public Object run(Context cx) {
    ScriptableObject.callMethod
      (scriptable, HANDLE_EVENT, array);
    return null;
  }
};

代码示例来源:origin: ro.isdc.wro4j/rhino

/**
 * Call a method of an object.
 * @param obj the JavaScript object
 * @param methodName the name of the function property
 * @param args the arguments for the call
 *
 * @see Context#getCurrentContext()
 */
public static Object callMethod(Scriptable obj, String methodName,
                Object[] args)
{
  return callMethod(null, obj, methodName, args);
}

代码示例来源:origin: com.github.tntim96/rhino

/**
 * Call a method of an object.
 * @param obj the JavaScript object
 * @param methodName the name of the function property
 * @param args the arguments for the call
 *
 * @see Context#getCurrentContext()
 */
public static Object callMethod(Scriptable obj, String methodName,
                Object[] args)
{
  return callMethod(null, obj, methodName, args);
}

代码示例来源:origin: com.sun.phobos/phobos-rhino

/**
 * Call a method of an object.
 * @param obj the JavaScript object
 * @param methodName the name of the function property
 * @param args the arguments for the call
 *
 * @see Context#getCurrentContext()
 */
public static Object callMethod(Scriptable obj, String methodName,
                Object[] args)
{
  return callMethod(null, obj, methodName, args);
}

代码示例来源:origin: org.apache.bsf/bsf-utils

public OMElement toOMElement(Object scriptXML) throws ScriptException {
    if (scriptXML == null) {
      return null;
    }

    if (!(scriptXML instanceof XMLObject)) {
      return null;
    }

    Object o = ScriptableObject.callMethod( (Scriptable) scriptXML, "getXmlObject", new Object[0]);
    return (OMElement) o;
//        return (OMElement) ScriptableObject.callMethod( (Scriptable) scriptXML, "getXmlObject", new Object[0]);
  }

代码示例来源:origin: rhino/js

/**
 * Call a method of an object.
 * @param obj the JavaScript object
 * @param methodName the name of the function property
 * @param args the arguments for the call
 *
 * @see Context#getCurrentContext()
 */
public static Object callMethod(Scriptable obj, String methodName,
                Object[] args)
{
  return callMethod(null, obj, methodName, args);
}

代码示例来源:origin: io.apigee/rhino

/**
 * Call a method of an object.
 * @param obj the JavaScript object
 * @param methodName the name of the function property
 * @param args the arguments for the call
 *
 * @see Context#getCurrentContext()
 */
public static Object callMethod(Scriptable obj, String methodName,
                Object[] args)
{
  return callMethod(null, obj, methodName, args);
}

代码示例来源:origin: com.atlassian.pluginkit/ringojs-kit

public static Object callMethod(Scriptable obj, String methodName, Object[] args)
{
  return ScriptableObject.callMethod(obj, methodName, args);
}

代码示例来源:origin: apache/batik

public Object run(Context cx) {
    ScriptableObject.callMethod
      (scriptable, HANDLE_EVENT, array);
    return null;
  }
};

代码示例来源:origin: geogebra/geogebra

/**
 * Call a method of an object.
 * @param obj the JavaScript object
 * @param methodName the name of the function property
 * @param args the arguments for the call
 *
 * @see Context#getCurrentContext()
 */
public static Object callMethod(Scriptable obj, String methodName,
                Object[] args)
{
  return callMethod(null, obj, methodName, args);
}

代码示例来源:origin: com.atlassian.pluginkit/ringojs-kit

public static Object callMethod(Context cx, Scriptable obj, String methodName, Object[] args)
{
  return ScriptableObject.callMethod(cx, obj, methodName, args);
}

代码示例来源:origin: smartrics/RestFixture

private void callMethodOnJsObject(Scriptable o, String mName, Object... arg) {
  ScriptableObject.callMethod(o, mName, arg);
}

代码示例来源:origin: org.apache.xmlgraphics/batik-bridge

public Object run(Context cx) {
    ScriptableObject.callMethod
      (obj, methodName, ab.buildArguments());
    return null;
  }
});

代码示例来源:origin: org.apache.sling/org.apache.sling.scripting.javascript

private void addImportedClasses(Context cx, Scriptable scope,
                Class<?>[] classes) {
  if (classes != null && classes.length > 0) {
    NativeJavaClass[] np = new NativeJavaClass[classes.length];
    for (int i = 0; i < classes.length; i++) {
      np[i] = new NativeJavaClass(scope, classes[i]);
    }
    ScriptableObject.callMethod(cx, scope, "importClass", np);
  }
}

代码示例来源:origin: fr.avianey.apache-xmlgraphics/batik

public Object run(Context cx) {
    ScriptableObject.callMethod
      (obj, methodName, ab.buildArguments());
    return null;
  }
});

代码示例来源:origin: org.apache.sling/org.apache.sling.scripting.javascript

private void addImportedPackages(Context cx, Scriptable scope,
                 String[] packages) {
  if (packages != null && packages.length > 0) {
    NativeJavaPackage[] np = new NativeJavaPackage[packages.length];
    for (int i = 0; i < packages.length; i++) {
      np[i] = new NativeJavaPackage(packages[i]);
    }
    ScriptableObject.callMethod(cx, scope, "importPackage", np);
  }
}

代码示例来源:origin: apache/batik

public Object run(Context cx) {
    ScriptableObject.callMethod
      (obj, methodName, ab.buildArguments());
    return null;
  }
});

代码示例来源:origin: wso2/wso2-synapse

/**
 * This method will convert the message payload in to xml
 *
 * @param scriptXML from java script Scriptable
 * @return XML content as OMElement wrapped in Scriptable object
 * @throws ScriptException when error
 */
public OMElement toOMElement(Object scriptXML)
    throws ScriptException {
  if (scriptXML == null) {
    return null;
  }
  if (!(scriptXML instanceof XMLObject)) {
    return null;
  }
  // TODO: E4X Bug? Shouldn't need this copy, but without it the outer element gets lost???
  Scriptable jsXML = (Scriptable) ScriptableObject.callMethod((Scriptable) scriptXML, "copy", new Object[0]);
  OMElement omElement;
  try {
    omElement = AXIOMUtil.stringToOM((String) ScriptableObject.callMethod(jsXML, "toXMLString", new Object[0]));
  } catch (XMLStreamException e) {
    throw new ScriptException(e);
  }
  return omElement;
}

代码示例来源:origin: org.apache.bsf/bsf-utils

public OMElement toOMElement(Object scriptXML) throws ScriptException {
  if (scriptXML == null) {
    return null;
  }
  if (!(scriptXML instanceof XMLObject)) {
    return null;
  }
  // TODO: E4X Bug? Shouldn't need this copy, but without it the outer element gets lost???
  Scriptable jsXML =
    (Scriptable) ScriptableObject.callMethod((Scriptable) scriptXML, "copy", new Object[0]);
  Wrapper wrapper =
    (Wrapper) ScriptableObject.callMethod(jsXML, "getXmlObject", new Object[0]);
  XmlObject xmlObject = (XmlObject) wrapper.unwrap();
  try {
    StAXOMBuilder builder = new StAXOMBuilder(xmlObject.newInputStream());
    return builder.getDocumentElement();
  } catch (XMLStreamException e) {
    throw new ScriptException(e);
  }
}

相关文章

微信公众号

ScriptableObject类方法