public class JavetJVMInterceptor extends BaseJavetDirectCallableInterceptor
javet
in V8.
It must be accompanied by JavetProxyConverter
.
Usages:
let sb = new javet.package.java.util.StringBuilder();
sb.append(123).append('abc');
sb.toString(); // 123abc
sb = undefined;
javet.v8.gc();
IJavetDirectCallable.DirectCall, IJavetDirectCallable.GetterAndNoThis<E extends java.lang.Exception>, IJavetDirectCallable.GetterAndThis<E extends java.lang.Exception>, IJavetDirectCallable.NoThisAndNoResult<E extends java.lang.Exception>, IJavetDirectCallable.NoThisAndResult<E extends java.lang.Exception>, IJavetDirectCallable.SetterAndNoThis<E extends java.lang.Exception>, IJavetDirectCallable.SetterAndThis<E extends java.lang.Exception>, IJavetDirectCallable.ThisAndNoResult<E extends java.lang.Exception>, IJavetDirectCallable.ThisAndResult<E extends java.lang.Exception>
Modifier and Type | Field and Description |
---|---|
protected java.util.List<JavetCallbackContext> |
callbackContexts
The Callback contexts.
|
static java.lang.String |
DEFAULT_NAME
The constant DEFAULT_NAME.
|
protected static java.lang.String |
ERROR_THE_CONVERTER_MUST_BE_INSTANCE_OF_JAVET_PROXY_CONVERTER
The constant ERROR_THE_CONVERTER_MUST_BE_INSTANCE_OF_JAVET_PROXY_CONVERTER.
|
protected static JavetProxyConverter |
JAVET_PROXY_CONVERTER
The constant JAVET_PROXY_CONVERTER.
|
protected static java.lang.String |
JS_PROPERTY_PACKAGE
The constant JS_PROPERTY_PACKAGE.
|
protected static java.lang.String |
JS_PROPERTY_V8
The constant JS_PROPERTY_V8.
|
protected java.lang.String |
name
The Name injected in V8.
|
v8Runtime
Constructor and Description |
---|
JavetJVMInterceptor(V8Runtime v8Runtime)
Instantiates a new Javet JVM interceptor.
|
Modifier and Type | Method and Description |
---|---|
void |
addCallbackContexts(JavetCallbackContext... callbackContexts)
Add callback contexts to extend the capabilities of the interceptor.
|
JavetCallbackContext[] |
getCallbackContexts()
Get supported callback contexts.
|
java.lang.String |
getName()
Gets name.
|
boolean |
register(IV8ValueObject... iV8ValueObjects)
Register the interceptor to the given V8 value object.
|
void |
setName(java.lang.String name)
Sets name.
|
boolean |
unregister(IV8ValueObject... iV8ValueObjects)
Unregister the interceptor from the given V8 value object.
|
getV8Runtime
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
setV8Runtime
public static final java.lang.String DEFAULT_NAME
protected static final java.lang.String ERROR_THE_CONVERTER_MUST_BE_INSTANCE_OF_JAVET_PROXY_CONVERTER
protected static final JavetProxyConverter JAVET_PROXY_CONVERTER
protected static final java.lang.String JS_PROPERTY_PACKAGE
protected static final java.lang.String JS_PROPERTY_V8
protected java.util.List<JavetCallbackContext> callbackContexts
protected java.lang.String name
public JavetJVMInterceptor(V8Runtime v8Runtime)
v8Runtime
- the V8 runtimepublic void addCallbackContexts(JavetCallbackContext... callbackContexts)
register(IV8ValueObject...)
is called.callbackContexts
- the callback contextspublic JavetCallbackContext[] getCallbackContexts()
IJavetDirectCallable
public java.lang.String getName()
public boolean register(IV8ValueObject... iV8ValueObjects) throws JavetException
IJavetInterceptor
register
in interface IJavetInterceptor
register
in class BaseJavetInterceptor
iV8ValueObjects
- the V8 value objectsJavetException
- the javet exceptionpublic void setName(java.lang.String name)
name
- the namepublic boolean unregister(IV8ValueObject... iV8ValueObjects) throws JavetException
IJavetInterceptor
unregister
in interface IJavetInterceptor
unregister
in class BaseJavetInterceptor
iV8ValueObjects
- the V8 value objectsJavetException
- the javet exception