Class JVMBridgeListener
Base class managing events from JVM. Implements IJVMBridgeBase. Extend this base class to manage events from the JVM
public class JVMBridgeListener : JVMBridgeBase<JVMBridgeListener>, IDynamicMetaObjectProvider, IJVMBridgeCore, IDisposable, IJVMBridgeBaseStatic, IJVMBridgeBase, IJVMBridgeDefinition
- Inheritance
-
JVMBridgeListener
- Implements
- Inherited Members
- Extension Methods
Examples
The following is the implementation of the Java ActionListener interface managed from the object JCActionListener (see Java help for implementation)
It use CLRActionEventData as typeparam of the generic CLRListenerEventArgs<TDataClass>
public sealed class CLRActionListener : JVMBridgeListener
{
public override string ClassName { get { return "org.mases.jcobridge.specialized.JCActionListener"; } } // the full name of class, in the JVM counterpart, of the Java class implementing the event
public CLRActionListener(EventHandler<CLRListenerEventArgs<CLRActionEventData>> handler) // the handler with the expected type
{
AddEventHandler("actionPerformed", handler); // allocate the event handler associated to the action the Java interface to be managed in C#
}
}
Constructors
JVMBridgeListener()
Initialize a new instance of JVMBridgeListener
public JVMBridgeListener()
JVMBridgeListener(params object[])
Initialize a new instance of JVMBridgeListener
public JVMBridgeListener(params object[] args)
Parameters
args
object[]The arguments of constructor
Properties
AutoInit
Set to false to externally initialize this JVMBridgeListener instance using InitializeListener(IJVMBridgeBase)
public virtual bool AutoInit { get; }
Property Value
BridgeClassName
Java class name to be instantiated
public override string BridgeClassName { get; }
Property Value
IsBridgeCloseable
true if the BridgeClassName implements Closeable
public override bool IsBridgeCloseable { get; }
Property Value
IsBridgeListener
true if the BridgeClassName follows the listener pattern of JCOBridge: the BridgeClassName extends a JCListener or implements IJCListener
public override sealed bool IsBridgeListener { get; }
Property Value
IsBridgeStatic
true if the BridgeClassName is a static class, i.e. does not have any public constructor
public override bool IsBridgeStatic { get; }
Property Value
Methods
AddEventHandler(string, EventHandler)
Adds an handler to manage events from JVM
protected void AddEventHandler(string action, EventHandler handler)
Parameters
action
stringThe action to be managed
handler
EventHandlerThe CLR handler associated to the JVM event
AddEventHandler<TDataClass>(string, EventHandler<CLRListenerEventArgs<TDataClass>>)
Adds an handler to manage events from JVM
protected void AddEventHandler<TDataClass>(string action, EventHandler<CLRListenerEventArgs<TDataClass>> handler) where TDataClass : CLREventData
Parameters
action
stringThe action to be managed
handler
EventHandler<CLRListenerEventArgs<TDataClass>>The CLR handler associated to the JVM event
Type Parameters
TDataClass
The class which manages event data in CLR format
Dispose()
Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
public override void Dispose()