public interface GeneratingMethodReaderInterceptorReturns
extends net.openhft.chronicle.bytes.MethodReaderInterceptorReturns
MethodReaderInterceptorReturns that lets generated
readers inline custom logic without reflection overhead.
Code returned by codeBeforeCall(Method, String, String[]) and
codeAfterCall(Method, String, String[]) is inserted before and after
the actual invocation in the generated reader. The snippets may reference
the deserialised argument variables and the target object instance.
Simple example that skips the call of method "foo" when its second argument is null:
public String codeBeforeCall(Method m, String objectName, String[] argumentNames) {
if (m.getName().equals("foo"))
return "if (" + argumentNames[1] + " != null) {";
else
return "";
}
public String codeAfterCall(Method m, String objectName, String[] argumentNames) {
if (m.getName().equals("foo"))
return "}";
else
return "";
}
Please mind that if provided code fails to compile, reflexive method call will be delegated to the interceptor
with MethodReaderInterceptorReturns.intercept(Method, Object, Object[], Invocation), like it happens with a regular
MethodReaderInterceptorReturns.
| Modifier and Type | Method and Description |
|---|---|
String |
codeAfterCall(Method m,
String objectName,
String[] argumentNames) |
String |
codeBeforeCall(Method m,
String objectName,
String[] argumentNames) |
String |
generatorId()
Specifies ID of this generating interceptor.
Contract: if the code provided by generating interceptor differs from the code provided by another generating interceptor, theirs IDs should be different as well. |
String generatorId()
String codeBeforeCall(Method m, String objectName, String[] argumentNames)
m - Calling method.objectName - Object instance name.argumentNames - Call argument names.Copyright © 2026 Chronicle Software Ltd. All rights reserved.