Table of Contents

Class JCOBridge

Namespace
MASES.JCOBridge.C2JBridge
Assembly
C2JBridge.dll

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

IJVMBridgeCore

Methods

Convert(JavaException)

Converts a generic JavaException into a known exception

public static Exception Convert(JavaException jException)

Parameters

jException JavaException

The 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 Exception Convert<TException>(JavaException jException) where TException : JVMBridgeException<TException>

Parameters

jException JavaException

The JavaException to be converted

Returns

Exception

The exception converted into TException or JavaException if it is not convertible

Type Parameters

TException

Expected JVMBridgeException class of the exception

GetMainClasses(Assembly)

Retrieve all Main-Class from the assembly

public static IDictionary<string, Type> GetMainClasses(Assembly assembly)

Parameters

assembly Assembly

The Assembly to analyze

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

wrapper IJVMBridgeCore

The IJVMBridgeCore instance to be globalized

thrownOnError bool

Raise exception if an instance was previously globalized

Globalize<TClass>()

Initialize and globalize the class

public static void Globalize<TClass>() where TClass : SetupJVMWrapper

Type Parameters

TClass

A class extending SetupJVMWrapper

Launch(Type, params string[])

Launch the type with the args arguments

public static void Launch(Type type, params string[] args)

Parameters

type Type

The Type extending IJVMBridgeMain

args string[]

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

args string[]

The arguments of the main method

Type Parameters

TClass

A 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

jException Type

The 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

TException

Expected 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

jExceptions IEnumerable<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

assembly Assembly

The 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

tInterface Type

The Type extending IJVMBridgeBase

tWrapper Type

The 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

TWrapper

The wrapper implementing TInterface

TInterface

The 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

handler EventHandler<EventOrExceptionEventArgs>

An handler in the form of EventHandler<TEventArgs>, null to set back the default