public class JCVoidDelegate extends Object
void return type.
Pass an instance of this class (or a subclass) to CLR methods that expect a
void delegate parameter. When the CLR invokes the delegate, the bridge calls
DelegateInvoked(Object...) without expecting a return value.
The CLR delegate type is identified either by its fully qualified name
(JCVoidDelegate(String)) or by a pre-resolved JCType handle
(JCVoidDelegate(JCType)).
Override DelegateInvoked(Object...) to provide the delegate body.
The default implementation is a no-op.
For CLR delegates with a non-void return type, use JCDelegate instead.
See also: JCOReflector for usage examples.
| Constructor and Description |
|---|
JCVoidDelegate(JCType delegateType)
Constructs a
JCVoidDelegate from a pre-resolved JCType handle. |
JCVoidDelegate(String delegateTypeName)
Constructs a
JCVoidDelegate identified by the fully qualified CLR delegate
type name. |
| Modifier and Type | Method and Description |
|---|---|
void |
DelegateInvoked(Object... args)
Called by the bridge when the CLR invokes this delegate.
|
JCType |
getDelegateType()
Returns the pre-resolved CLR delegate type handle, or
null if this
instance was constructed with a type name string. |
String |
getDelegateTypeName()
Returns the fully qualified CLR delegate type name, or
null if this
instance was constructed with a JCType handle. |
public JCVoidDelegate(String delegateTypeName)
JCVoidDelegate identified by the fully qualified CLR delegate
type name. The name is resolved by the bridge when the delegate is passed to a
CLR method.delegateTypeName - the fully qualified CLR delegate type name,
e.g. "System.Action`1[System.String]".public JCVoidDelegate(JCType delegateType)
JCVoidDelegate from a pre-resolved JCType handle.
Use this overload when the delegate type has already been resolved via
JCOBridge.GetType(String) to avoid redundant type lookups.delegateType - the pre-resolved CLR delegate type handle.public String getDelegateTypeName()
null if this
instance was constructed with a JCType handle.public JCType getDelegateType()
null if this
instance was constructed with a type name string.JCType handle for the CLR delegate type.public void DelegateInvoked(Object... args)
Override this method to provide the delegate body. No return value is expected. The default implementation is a no-op.
args - the arguments passed by the CLR caller, in the order and types
declared by the CLR delegate signature.