public interface IJCListener
Implementations forward Java interface method calls to the CLR side by invoking one of
the raiseEvent overloads. Event identification supports two modes:
String. Convenient but incurs
a name-to-index resolution cost on every call.getEventIndex(String),
resolved once and cached by the caller. Preferred in high-frequency event paths as it
avoids the resolution overhead entirely.For non-void Java interface methods, the CLR handler must call
setReturnData(Object) before returning control to the JVM. The JVM implementation
then retrieves the value via getReturnData() and returns it to the original
Java caller.
| Modifier and Type | Method and Description |
|---|---|
Object[] |
extraData()
Returns the additional arguments associated with the current event.
|
int |
extraDataLength()
Returns the number of additional arguments associated with the current event.
|
Object |
getEventData()
Returns the primary data object associated with the current event.
|
int |
getEventIndex(String eventName)
Returns the numeric index associated with the given event name.
|
Object |
getReturnData()
Returns the return value set by the CLR handler for the current event.
|
boolean |
hasExtraData()
Returns
true if the current event has additional arguments beyond the primary
data object. |
void |
raiseEvent(int eventIndex)
Raises the event identified by numeric index on the CLR side with no associated data.
|
void |
raiseEvent(int eventIndex,
Object e)
Raises the event identified by numeric index on the CLR side, passing a single data object.
|
void |
raiseEvent(int eventIndex,
Object e,
Object... objects)
Raises the event identified by numeric index on the CLR side, passing a primary data object
and additional arguments.
|
void |
raiseEvent(String eventName)
Raises the named event on the CLR side with no associated data.
|
void |
raiseEvent(String eventName,
Object e)
Raises the named event on the CLR side, passing a single data object.
|
void |
raiseEvent(String eventName,
Object e,
Object... objects)
Raises the named event on the CLR side, passing a primary data object and additional arguments.
|
void |
release()
Releases the native resources held by this listener and unregisters it from the
JCOBridge runtime.
|
void |
setReturnData(Object retData)
Sets the return value that the CLR handler provides for the current event.
|
void release()
int getEventIndex(String eventName)
The returned index can be passed to the index-based raiseEvent overloads
to avoid name-lookup overhead in high-frequency event paths. The index should be
resolved once and cached by the caller.
eventName - the name of the event as registered on the CLR side.void raiseEvent(String eventName)
eventName - the name of the event to raise.void raiseEvent(int eventIndex)
Prefer this overload over the name-based variant in high-frequency paths.
eventIndex - the numeric index of the event to raise, as returned by
getEventIndex(String).void raiseEvent(String eventName, Object e)
eventName - the name of the event to raise.e - the data object associated with the event; accessible from the CLR
handler via getEventData().void raiseEvent(int eventIndex,
Object e)
Prefer this overload over the name-based variant in high-frequency paths.
eventIndex - the numeric index of the event to raise.e - the data object associated with the event; accessible from the CLR
handler via getEventData().void raiseEvent(String eventName, Object e, Object... objects)
eventName - the name of the event to raise.e - the primary data object associated with the event.objects - additional arguments forwarded to the CLR handler, accessible via
extraData().void raiseEvent(int eventIndex,
Object e,
Object... objects)
Prefer this overload over the name-based variant in high-frequency paths.
eventIndex - the numeric index of the event to raise.e - the primary data object associated with the event.objects - additional arguments forwarded to the CLR handler, accessible via
extraData().Object getEventData()
raiseEvent.null if no data was provided.boolean hasExtraData()
true if the current event has additional arguments beyond the primary
data object.true if extra data is available.int extraDataLength()
0 if none.Object[] extraData()
objects vararg passed to
raiseEvent.null if none was provided.Object getReturnData()
For non-void Java interface methods, the CLR handler must call
setReturnData(Object) before returning control to the JVM. The JVM
implementation then calls this method to retrieve the value and return it to the
original Java caller.
null if not set.void setReturnData(Object retData)
Must be called by the CLR runtime before control returns to the JVM for non-void
interface methods. The value is then retrieved by the JVM implementation via
getReturnData() and returned to the original Java caller.
retData - the value to return to the JVM caller; may be null for
reference types if the interface method allows it.