Table of Contents

Interface IJVMBridgeBase

Namespace
MASES.JCOBridge.C2JBridge
Assembly
C2JBridge.dll

Generic interface containing accessor of every JVMBridgeBase

public interface IJVMBridgeBase : IJVMBridgeDefinition
Inherited Members
Extension Methods

Remarks

Never implements this interface directly. Extends JVMBridgeBase or JVMBridgeBase<TClass> instead.

Properties

BridgeInstance

The IJavaObject instance

IJavaObject BridgeInstance { get; }

Property Value

IJavaObject

DynBridgeInstance

The dynamic accessor to BridgeInstance

dynamic DynBridgeInstance { get; }

Property Value

dynamic

Methods

CastDirect<TNewClass>()

Simplified version of CastTo<TNewClass>() which wraps this instance with a new TNewClass class

TNewClass CastDirect<TNewClass>() where TNewClass : IJVMBridgeBase, new()

Returns

TNewClass

An newly initialized TNewClass

Type Parameters

TNewClass

The class implementing IJVMBridgeBase

Remarks

Use this method with caution since no check on target TNewClass will be made

CastTo<TNewClass>()

Casts this IJVMBridgeBase object into TNewClass

TNewClass CastTo<TNewClass>() where TNewClass : IJVMBridgeBase, new()

Returns

TNewClass

The return value converted to TNewClass

Type Parameters

TNewClass

The return type expected which implements IJVMBridgeBase

Remarks

This method can checks the convertibility to TNewClass using CastTo(IJavaObjectBase, string, bool)

IsInstanceOf(IJavaType)

Verify if this IJVMBridgeBase is an instance of clazz

bool IsInstanceOf(IJavaType clazz)

Parameters

clazz IJavaType

The IJavaType to be checked

Returns

bool

true if clazz is an instance of clazz, otherwise false

IsInstanceOf(string)

Verify if this IJVMBridgeBase is an instance of clazz

bool IsInstanceOf(string clazz)

Parameters

clazz string

The class name to be checked

Returns

bool

true if clazz is an instance of clazz, otherwise false

IsInstanceOf<T>()

Verify if this IJVMBridgeBase is an instance of T

bool IsInstanceOf<T>() where T : IJVMBridgeBase, new()

Returns

bool

true if T is an instance of T, otherwise false

Type Parameters

T

A type implementing IJVMBridgeBase

MonitorEnter()

Enters the monitor associated with the underlying with this IJVMBridgeBase

void MonitorEnter()

Remarks

Each Java object has a monitor associated with it. If the current thread already owns the monitor associated with IJVMBridgeBase, the JVM increments a counter in the monitor indicating the number of times this thread has entered the monitor. If the monitor associated with IJVMBridgeBase is not owned by any thread, the current thread becomes the owner of the monitor, setting the entry count of this monitor to 1. If another thread already owns the monitor associated with obj, the current thread waits until the monitor is released, then tries again to gain ownership.

 A monitor entered through a <xref href="MASES.JCOBridge.C2JBridge.IJVMBridgeBase.MonitorEnter" data-throw-if-not-resolved="false"></xref> function call cannot be exited using the monitorexit Java virtual machine instruction or a synchronized method return.
 A <xref href="MASES.JCOBridge.C2JBridge.IJVMBridgeBase.MonitorEnter" data-throw-if-not-resolved="false"></xref> function call and a monitorenter Java virtual machine instruction may race to enter the monitor associated with the same object.
 To avoid deadlocks, a monitor entered through a <xref href="MASES.JCOBridge.C2JBridge.IJVMBridgeBase.MonitorEnter" data-throw-if-not-resolved="false"></xref> function call must be exited using the <xref href="MASES.JCOBridge.C2JBridge.IJVMBridgeBase.MonitorExit" data-throw-if-not-resolved="false"></xref> call, unless the DetachCurrentThread call is used to implicitly release JNI monitors.

MonitorExit()

Exits the monitor associated with the underlying with this IJVMBridgeBase

void MonitorExit()

Remarks

The current thread must be the owner of the monitor associated with the underlying Java object referred to by IJVMBridgeBase. The thread decrements the counter indicating the number of times it has entered this monitor. If the value of the counter becomes zero, the current thread releases the monitor. Native code must not use MonitorExit() to exit a monitor entered through a synchronized method or a monitorenter Java virtual machine instruction.

RuntimeIsInstanceOf<T>()

Verify if this IJVMBridgeBase is an instance of T; the constraints of T are checked at runtime, while IsInstanceOf<T>() checks T constraint at compile time

bool RuntimeIsInstanceOf<T>()

Returns

bool

true if T is an instance of T, otherwise false

Type Parameters

T

A type implementing IJVMBridgeBase