Class JCOBridge
General helper class
public static class JCOBridge
- Inheritance
-
JCOBridge
- Inherited Members
Properties
Global
The global instance pointer set with Globalize(IJVMBridgeCore, bool)
public static IJVMBridgeCore Global { get; }
Property Value
IsCLRHostingProcess
public static bool IsCLRHostingProcess { get; }
Property Value
LastBindingException
Reports last Exception raised from JCOBridge subsystem
public static Exception LastBindingException { get; }
Property Value
Methods
Convert(JavaException)
Converts a generic JavaException into a known exception
public static Exception Convert(JavaException jException)
Parameters
jExceptionJavaExceptionThe JavaException to be converted
Returns
- Exception
The exception converted into an instance of JVMBridgeException or JavaException if it is not convertible
Convert<TException>(JavaException)
Converts a generic JavaException into a known exception
public static TException Convert<TException>(JavaException jException) where TException : JVMBridgeException
Parameters
jExceptionJavaExceptionThe JavaException to be converted
Returns
- TException
The exception converted into
TExceptionor JavaException if it is not convertible
Type Parameters
TExceptionExpected JVMBridgeException class of the exception
GetMainClasses(Assembly)
Retrieve all Main-Class from the assembly
public static IDictionary<string, Type> GetMainClasses(Assembly assembly)
Parameters
Returns
- IDictionary<string, Type>
A IDictionary<TKey, TValue> containing the name of the Main-Class and its Type
Globalize(IJVMBridgeCore, bool)
Creates a new global instance pointer
public static void Globalize(this IJVMBridgeCore wrapper, bool thrownOnError = true)
Parameters
wrapperIJVMBridgeCoreThe IJVMBridgeCore instance to be globalized
thrownOnErrorboolRaise exception if an instance was previously globalized
Launch(Type, params string[])
Launch the type with the args arguments
public static void Launch(Type type, params string[] args)
Parameters
typeTypeThe Type extending IJVMBridgeMain
argsstring[]The arguments of the main method
Launch<TClass>(params string[])
Launch the TClass class with the args arguments
public static void Launch<TClass>(params string[] args) where TClass : IJVMBridgeMain
Parameters
argsstring[]The arguments of the main method
Type Parameters
TClassA type which is defined as Main-Class
RegisterException(Type)
Registers a generic Type, which inherit from JVMBridgeException, to be used in Convert<TException>(JavaException)
public static void RegisterException(Type jException)
Parameters
jExceptionTypeThe Type, which inherit from JVMBridgeException, to be registered
RegisterException<TException>()
Registers a generic TException, which inherit from JVMBridgeException, to be used in Convert<TException>(JavaException)
public static void RegisterException<TException>() where TException : JVMBridgeException
Type Parameters
TExceptionExpected a type inherited from JVMBridgeException class of the exception
RegisterExceptions(IEnumerable<Type>)
Registers a generic Type, which inherit from JVMBridgeException, to be used in Convert<TException>(JavaException)
public static void RegisterExceptions(IEnumerable<Type> jExceptions)
Parameters
jExceptionsIEnumerable<Type>The Types, which inherit from JVMBridgeException, to be registered
RegisterExceptions(Assembly)
Registers a set of JVMBridgeException to be used in Convert<TException>(JavaException)
public static void RegisterExceptions(this Assembly assembly)
Parameters
assemblyAssemblyThe Assembly to scan for type inherited from JVMBridgeException
RegisterWrapper(Type, Type)
Registers a wrapper class to be used when generics has interfaces
public static void RegisterWrapper(Type tInterface, Type tWrapper)
Parameters
tInterfaceTypeThe Type extending IJVMBridgeBase
tWrapperTypeThe Type implementing
tInterface
RegisterWrapper<TWrapper, TInterface>()
Registers a wrapper class to be used when generics has interfaces
public static void RegisterWrapper<TWrapper, TInterface>() where TWrapper : TInterface, new() where TInterface : IJVMBridgeBase
Type Parameters
TWrapperThe wrapper implementing
TInterfaceTInterfaceThe interface to be associated to the
TWrapper
SetEventOrExceptionHandler(EventHandler<EventOrExceptionEventArgs>)
Set a user defined EventHandler<TEventArgs> to receive info from JCOBridge
public static void SetEventOrExceptionHandler(EventHandler<EventOrExceptionEventArgs> handler)
Parameters
handlerEventHandler<EventOrExceptionEventArgs>An handler in the form of EventHandler<TEventArgs>, null to set back the default