C# Class Rhino.VMBridge

Show file Open project: hazzik/Rhino.Net

Public Methods

Method Description
GetJavaIterator ( Context cx, Scriptable scope, object obj ) : IEnumerator

If "obj" is a java.util.Iterator or a java.lang.Iterable, return a wrapping as a JavaScript Iterator.

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.

Protected Methods

Method Description
GetContext ( object contextHelper ) : Context

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

GetCurrentThreadClassLoader ( ) : ClassLoader

Return the ClassLoader instance associated with the current thread.

Return the ClassLoader instance associated with the current thread.

GetInterfaceProxyHelper ( ContextFactory cf, Type interfaces ) : object

Create helper object to create later proxies implementing the specified interfaces later.

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 }); 
GetThreadContextHelper ( ) : object

Return a helper object to optimize Context access.

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

IsVarArgs ( MemberInfo member ) : bool

Returns whether or not a given member (method or constructor) has variable arguments.

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.

NewInterfaceProxy ( object proxyHelper, ContextFactory cf, InterfaceAdapter adapter, object target, Scriptable topScope ) : object

Create proxy object for InterfaceAdapter . The proxy should call InterfaceAdapter.Invoke(ContextFactory, object, Scriptable, object, System.Reflection.MethodInfo, object[]) as implementation of interface methods associated with proxyHelper.

SetContext ( object contextHelper, Context cx ) : void

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

TryToMakeAccessible ( object accessibleObject ) : bool

In many JVMSs, public methods in private classes are not accessible by default (Sun Bug #4071593).

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.

Private Methods

Method Description
MakeInstance ( ) : VMBridge

Method Details

GetContext() protected abstract method

Get Context instance associated with the current thread or null if none.
protected abstract GetContext ( object contextHelper ) : Context
contextHelper object /// The result of /// GetThreadContextHelper() /// called from the current thread. ///
return Context

GetCurrentThreadClassLoader() protected abstract method

Return the ClassLoader instance associated with the current thread.
Return the ClassLoader instance associated with the current thread.
protected abstract GetCurrentThreadClassLoader ( ) : ClassLoader
return ClassLoader

GetInterfaceProxyHelper() protected method

Create helper object to create later proxies implementing the specified interfaces later.
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 }); 
protected GetInterfaceProxyHelper ( ContextFactory cf, Type interfaces ) : object
cf ContextFactory
interfaces System.Type Array with one or more interface class objects.
return object

GetJavaIterator() public method

If "obj" is a java.util.Iterator or a java.lang.Iterable, return a wrapping as a JavaScript Iterator.
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.
public GetJavaIterator ( Context cx, Scriptable scope, object obj ) : IEnumerator
cx Context
scope Scriptable
obj object
return IEnumerator

GetThreadContextHelper() protected abstract method

Return a helper object to optimize Context access.

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

protected abstract GetThreadContextHelper ( ) : object
return object

IsVarArgs() protected abstract method

Returns whether or not a given member (method or constructor) has variable arguments.
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.
protected abstract IsVarArgs ( MemberInfo member ) : bool
member System.Reflection.MemberInfo
return bool

NewInterfaceProxy() protected method

Create proxy object for InterfaceAdapter . The proxy should call InterfaceAdapter.Invoke(ContextFactory, object, Scriptable, object, System.Reflection.MethodInfo, object[]) as implementation of interface methods associated with proxyHelper.
protected NewInterfaceProxy ( object proxyHelper, ContextFactory cf, InterfaceAdapter adapter, object target, Scriptable topScope ) : object
proxyHelper object /// The result of the previous call to /// GetInterfaceProxyHelper(ContextFactory, System.Type<T>[]) /// . ///
cf ContextFactory
adapter InterfaceAdapter
target object
topScope Scriptable
return object

SetContext() protected abstract method

Associate Context instance with the current thread or remove the current association if cx is null.
protected abstract SetContext ( object contextHelper, Context cx ) : void
contextHelper object /// The result of /// GetThreadContextHelper() /// called from the current thread. ///
cx Context
return void

TryToMakeAccessible() protected abstract method

In many JVMSs, public methods in private classes are not accessible by default (Sun Bug #4071593).
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.
protected abstract TryToMakeAccessible ( object accessibleObject ) : bool
accessibleObject object
return bool