當前位置: 首頁>>代碼示例>>Java>>正文


Java ScriptableObject.getProperty方法代碼示例

本文整理匯總了Java中org.mozilla.javascript.ScriptableObject.getProperty方法的典型用法代碼示例。如果您正苦於以下問題:Java ScriptableObject.getProperty方法的具體用法?Java ScriptableObject.getProperty怎麽用?Java ScriptableObject.getProperty使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.mozilla.javascript.ScriptableObject的用法示例。


在下文中一共展示了ScriptableObject.getProperty方法的12個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: testJsApi

import org.mozilla.javascript.ScriptableObject; //導入方法依賴的package包/類
public void testJsApi() throws Exception {
    Context cx = Context.enter();
    cx.setOptimizationLevel(-1);
    Script script = cx.compileReader(new InputStreamReader(
            Bug482203.class.getResourceAsStream("conttest.js")), 
            "", 1, null);
    Scriptable scope = cx.initStandardObjects();
    script.exec(cx, scope);
    for(;;)
    {
        Object cont = ScriptableObject.getProperty(scope, "c");
        if(cont == null)
        {
            break;
        }
        ((Callable)cont).call(cx, scope, scope, new Object[] { null });
    }
}
 
開發者ID:middle2tw,項目名稱:whackpad,代碼行數:19,代碼來源:Bug482203.java

示例2: testJavaApi

import org.mozilla.javascript.ScriptableObject; //導入方法依賴的package包/類
public void testJavaApi() throws Exception {
    Context cx = Context.enter();
    try {
     cx.setOptimizationLevel(-1);
     Script script = cx.compileReader(new InputStreamReader(
             Bug482203.class.getResourceAsStream("conttest.js")), 
             "", 1, null);
     Scriptable scope = cx.initStandardObjects();
     cx.executeScriptWithContinuations(script, scope);
     for(;;)
     {
         Object cont = ScriptableObject.getProperty(scope, "c");
         if(cont == null)
         {
             break;
         }
         cx.resumeContinuation(cont, scope, null);
     }
    } finally {
    	Context.exit();
    }
}
 
開發者ID:middle2tw,項目名稱:whackpad,代碼行數:23,代碼來源:Bug482203.java

示例3: createFields

import org.mozilla.javascript.ScriptableObject; //導入方法依賴的package包/類
@Benchmark
@SuppressWarnings("unused")
void createFields(int count)
{
    Function create = (Function)ScriptableObject.getProperty(scope, "createObject");
    create.call(cx, scope, null, new Object[]{count, strings, ints});
}
 
開發者ID:F43nd1r,項目名稱:rhino-android,代碼行數:8,代碼來源:CaliperObjectBenchmark.java

示例4: accessFields

import org.mozilla.javascript.ScriptableObject; //導入方法依賴的package包/類
@Benchmark
@SuppressWarnings("unused")
void accessFields(int count)
{
    Function create = (Function)ScriptableObject.getProperty(scope, "createObject");
    Object o = create.call(cx, scope, null, new Object[]{1, strings, ints});
    Function access = (Function)ScriptableObject.getProperty(scope, "accessObject");
    access.call(cx, scope, null, new Object[] {count, o, strings, ints});
}
 
開發者ID:F43nd1r,項目名稱:rhino-android,代碼行數:10,代碼來源:CaliperObjectBenchmark.java

示例5: iterateFields

import org.mozilla.javascript.ScriptableObject; //導入方法依賴的package包/類
@Benchmark
@SuppressWarnings("unused")
void iterateFields(long count)
{
    Function create = (Function)ScriptableObject.getProperty(scope, "createObject");
    Object o = create.call(cx, scope, null, new Object[]{1, strings, ints});
    Function iterate = (Function)ScriptableObject.getProperty(scope, "iterateObject");
    iterate.call(cx, scope, null, new Object[] {count, o});
}
 
開發者ID:F43nd1r,項目名稱:rhino-android,代碼行數:10,代碼來源:CaliperObjectBenchmark.java

示例6: ownKeysFields

import org.mozilla.javascript.ScriptableObject; //導入方法依賴的package包/類
@Benchmark
@SuppressWarnings("unused")
void ownKeysFields(long count)
{
    Function create = (Function)ScriptableObject.getProperty(scope, "createObject");
    Object o = create.call(cx, scope, null, new Object[]{1, strings, ints});
    Function iterate = (Function)ScriptableObject.getProperty(scope, "iterateOwnKeysObject");
    iterate.call(cx, scope, null, new Object[] {count, o});
}
 
開發者ID:F43nd1r,項目名稱:rhino-android,代碼行數:10,代碼來源:CaliperObjectBenchmark.java

示例7: deleteFields

import org.mozilla.javascript.ScriptableObject; //導入方法依賴的package包/類
@Benchmark
@SuppressWarnings("unused")
void deleteFields(int count)
{
    Function create = (Function)ScriptableObject.getProperty(scope, "createObject");
    Object o = create.call(cx, scope, null, new Object[]{1, strings, ints});
    Function delete = (Function)ScriptableObject.getProperty(scope, "deleteObject");
    delete.call(cx, scope, null, new Object[] {count, o, strings, ints});
}
 
開發者ID:F43nd1r,項目名稱:rhino-android,代碼行數:10,代碼來源:CaliperObjectBenchmark.java

示例8: testJsApi

import org.mozilla.javascript.ScriptableObject; //導入方法依賴的package包/類
public void testJsApi() throws Exception {
    Context cx = RhinoAndroidHelper.prepareContext();
    try {
        cx.setOptimizationLevel(-1);
        Script script = cx.compileString(TestUtils.readAsset("Bug482203.js"),
                "", 1, null);
        Scriptable scope = cx.initStandardObjects();
        script.exec(cx, scope);
        int counter = 0;
        for(;;)
        {
            Object cont = ScriptableObject.getProperty(scope, "c");
            if(cont == null)
            {
                break;
            }
            counter++;
            ((Callable)cont).call(cx, scope, scope, new Object[] { null });
        }
        assertEquals(counter, 5);
        assertEquals(Double.valueOf(3), ScriptableObject.getProperty(scope, "result"));
    } finally {
        Context.exit();
    }
}
 
開發者ID:F43nd1r,項目名稱:rhino-android,代碼行數:26,代碼來源:Bug482203Test.java

示例9: testJavaApi

import org.mozilla.javascript.ScriptableObject; //導入方法依賴的package包/類
public void testJavaApi() throws Exception {
    Context cx = RhinoAndroidHelper.prepareContext();
    try {
        cx.setOptimizationLevel(-1);
        Script script = cx.compileString(TestUtils.readAsset("Bug482203.js"),
                "", 1, null);
        Scriptable scope = cx.initStandardObjects();
        cx.executeScriptWithContinuations(script, scope);
        int counter = 0;
        for(;;)
        {
            Object cont = ScriptableObject.getProperty(scope, "c");
            if(cont == null)
            {
                break;
            }
            counter++;
            cx.resumeContinuation(cont, scope, null);
        }
        assertEquals(counter, 5);
        assertEquals(Double.valueOf(3), ScriptableObject.getProperty(scope, "result"));
    } finally {
    	Context.exit();
    }
}
 
開發者ID:F43nd1r,項目名稱:rhino-android,代碼行數:26,代碼來源:Bug482203Test.java

示例10: testCompiledJs

import org.mozilla.javascript.ScriptableObject; //導入方法依賴的package包/類
@Test
public void testCompiledJs() throws Exception {
  // The main module calls a soy template and alerts the output.
  // Replace alert with something that lets us capture the output.
  cx.evaluateString(
      scope, "var _alerts_ = []; alert = function (s) { _alerts_.push(s); }",
      "test", 1, null);

  loadJsModule("/closure/js/main.js");
  loadJsModule("/closure/js/hello.world.js");

  NativeArray alerts = (NativeArray)
      ScriptableObject.getProperty(scope, "_alerts_");

  assertEquals(
      "<div id=\"greeting\">Hello, <b class=\"b\">Cle&lt;eland</b>!</div>",
      Context.toString(alerts.get(0)));
}
 
開發者ID:mikesamuel,項目名稱:closure-maven-plugin,代碼行數:19,代碼來源:CompiledJsTest.java

示例11: get

import org.mozilla.javascript.ScriptableObject; //導入方法依賴的package包/類
@Override
public Object get(final Object key) {
    Object retval;
    if (key instanceof Number) {
        retval = ScriptableObject.getProperty(s, ((Number) key).intValue());
    } else {
        retval = ScriptableObject.getProperty(s, String.valueOf(key));
    }
    return ScriptableConverter.jsToJava(retval);
}
 
開發者ID:szegedi,項目名稱:spring-web-jsflow,代碼行數:11,代碼來源:ScriptableMap.java

示例12: readPropFoo

import org.mozilla.javascript.ScriptableObject; //導入方法依賴的package包/類
public Object readPropFoo(final Scriptable s) {
    return ScriptableObject.getProperty(s, "foo");
}
 
開發者ID:middle2tw,項目名稱:whackpad,代碼行數:4,代碼來源:PrimitiveTypeScopeResolutionTest.java


注:本文中的org.mozilla.javascript.ScriptableObject.getProperty方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。