Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.mozilla.javascript
Class VMBridge

    java.lang.Object
      org.mozilla.javascript.VMBridge

Direct Known Subclasses:
  VMBridge_jdk13

    public abstract class VMBridge

extends java.lang.Object

Constructor Summary
`VMBridge()`

Method Summary
`protected abstract Context` | `getContext(java.lang.Object contextHelper)` Get `Context` instance associated with the current thread or null if none.
`protected abstract java.lang.ClassLoader` | `getCurrentThreadClassLoader()` Return the ClassLoader instance associated with the current thread.
`protected java.lang.Object` | `getInterfaceProxyHelper(ContextFactory cf, java.lang.Class<?>[] interfaces)` Create helper object to create later proxies implementing the specified interfaces later.
`java.util.Iterator<?>` | `getJavaIterator(Context cx, Scriptable scope, java.lang.Object obj)` If "obj" is a java.util.Iterator or a java.lang.Iterable, return a wrapping as a JavaScript Iterator.
`protected abstract java.lang.Object` | `getThreadContextHelper()` Return a helper object to optimize `Context` access.
`protected abstract boolean` | `isVarArgs(java.lang.reflect.Member member)` Returns whether or not a given member (method or constructor) has variable arguments.
`protected java.lang.Object` | `newInterfaceProxy(java.lang.Object proxyHelper, ContextFactory cf, InterfaceAdapter adapter, java.lang.Object target, Scriptable topScope)` Create proxy object for `InterfaceAdapter`.
`protected abstract void` | `setContext(java.lang.Object contextHelper, Context cx)` Associate `Context` instance with the current thread or remove the current association if `cx` is null.
`protected abstract boolean` | `tryToMakeAccessible(java.lang.Object accessibleObject)` In many JVMSs, public methods in private classes are not accessible by default (Sun Bug #4071593).

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### VMBridge

    public VMBridge()

Method Detail

### getThreadContextHelper

    protected abstract java.lang.Object getThreadContextHelper()

  Return a helper object to optimize `Context` access.

  The runtime will pass the resulting helper object to the subsequent calls to `getContext(Object contextHelper)` and `setContext(Object contextHelper, Context cx)` methods. In this way the implementation can use the helper to cache information about current thread to make `Context` access faster.

### getContext

    protected abstract Context getContext(java.lang.Object contextHelper)

  Get `Context` instance associated with the current thread or null if none.

  Parameters:
    `contextHelper` - The result of `getThreadContextHelper()` called from the current thread.

### setContext

    protected abstract void setContext(java.lang.Object contextHelper,
                                       Context cx)

  Associate `Context` instance with the current thread or remove the current association if `cx` is null.

  Parameters:
    `contextHelper` - The result of `getThreadContextHelper()` called from the current thread.

### getCurrentThreadClassLoader

    protected abstract java.lang.ClassLoader getCurrentThreadClassLoader()

  Return the ClassLoader instance associated with the current thread.

### tryToMakeAccessible

    protected abstract boolean tryToMakeAccessible(java.lang.Object accessibleObject)

  In many JVMSs, public methods in private classes are not accessible by default (Sun Bug #4071593). VMBridge instance should try to workaround that via, for example, calling method.setAccessible(true) when it is available. The implementation is responsible to catch all possible exceptions like SecurityException if the workaround is not available.

  Returns:
    true if it was possible to make method accessible or false otherwise.

### getInterfaceProxyHelper

    protected java.lang.Object getInterfaceProxyHelper(ContextFactory cf,
                                                       java.lang.Class<?>[] interfaces)

  Create helper object to create later proxies implementing the specified interfaces later. Under JDK 1.3 the implementation can look like:

       return java.lang.reflect.Proxy.getProxyClass(..., interfaces).
           getConstructor(new Class[] {
               java.lang.reflect.InvocationHandler.class });

  Parameters:
    `interfaces` - Array with one or more interface class objects.

### newInterfaceProxy

    protected java.lang.Object newInterfaceProxy(java.lang.Object proxyHelper,
                                                 ContextFactory cf,
                                                 InterfaceAdapter adapter,
                                                 java.lang.Object target,
                                                 Scriptable topScope)

  Create proxy object for `InterfaceAdapter`. The proxy should call `InterfaceAdapter.invoke(ContextFactory cf, Object target, Scriptable topScope, Method method, Object[] args)` as implementation of interface methods associated with `proxyHelper`.

  Parameters:
    `proxyHelper` - The result of the previous call to `getInterfaceProxyHelper(ContextFactory, Class[])`.

### isVarArgs

    protected abstract boolean isVarArgs(java.lang.reflect.Member member)

  Returns whether or not a given member (method or constructor) has variable arguments. Variable argument methods have only been supported in Java since JDK 1.5.

### getJavaIterator

    public java.util.Iterator<?> getJavaIterator(Context cx,
                                                 Scriptable scope,
                                                 java.lang.Object obj)

  If "obj" is a java.util.Iterator or a java.lang.Iterable, return a wrapping as a JavaScript Iterator. Otherwise, return null. This method is in VMBridge since Iterable is a JDK 1.5 addition.

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD