public class VanillaMethodReader extends Object implements net.openhft.chronicle.bytes.MethodReader
MarshallableIn source and dispatches each
one as a method call on the supplied handler objects. A WireParser
maps event names or method identifiers to the correct handler method.
The reader can operate either via a slower reflection proxy (deprecated) or
a generated high-performance implementation, see GenerateMethodReader.
Use VanillaMethodReaderBuilder to configure instances.
Supports interception via MethodReaderInterceptorReturns and custom
parsing through WireParselet and FieldNumberParselet.
| Modifier and Type | Field and Description |
|---|---|
static boolean |
DEBUG_ENABLED
Flag to enable debug logging of messages being read.
|
| Constructor and Description |
|---|
VanillaMethodReader(MarshallableIn in,
boolean ignoreDefault,
WireParselet defaultParselet,
FieldNumberParselet fieldNumberParselet,
net.openhft.chronicle.bytes.MethodReaderInterceptorReturns methodReaderInterceptorReturns,
Object... handlers)
Convenience constructor used by generated code.
|
VanillaMethodReader(MarshallableIn in,
boolean ignoreDefault,
WireParselet defaultParselet,
FieldNumberParselet fieldNumberParselet,
net.openhft.chronicle.bytes.MethodReaderInterceptorReturns methodReaderInterceptorReturns,
Object[] metadataHandlers,
Object... handlers)
Constructor that defaults the predicate to always true.
|
VanillaMethodReader(MarshallableIn in,
boolean ignoreDefault,
WireParselet defaultParselet,
FieldNumberParselet fieldNumberParselet,
net.openhft.chronicle.bytes.MethodReaderInterceptorReturns methodReaderInterceptorReturns,
Object[] metadataHandlers,
Predicate<net.openhft.chronicle.bytes.MethodReader> predicate,
Object... handlers)
Primary constructor configuring parsers and interceptors.
|
VanillaMethodReader(MarshallableIn in,
boolean ignoreDefault,
WireParselet defaultParselet,
net.openhft.chronicle.bytes.MethodReaderInterceptorReturns methodReaderInterceptorReturns,
Object[] metadataHandlers,
Object... handlers)
Convenience constructor used by generated code.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addParseletForMethod(WireParser wireParser,
Object target,
Object[] contextHolder,
Supplier contextSupplier,
@NotNull Method method)
Register a zero argument method with
wireParser. |
void |
addParseletForMethod(WireParser wireParser,
Object target,
Object[] contextHolder,
Supplier contextSupplier,
@NotNull Method method,
@NotNull Class[] parameterTypes)
Registers a method with multiple arguments with the provided WireParser.
|
void |
addParseletForMethod(WireParser wireParser,
Object target,
Object[] contextHolder,
Supplier contextSupplier,
@NotNull Method method,
@NotNull Class[] parameterTypes,
MethodFilterOnFirstArg methodFilterOnFirstArg)
Registers a method with multiple arguments with the provided WireParser, applying a filter on the first argument.
|
void |
addParseletForMethod(WireParser wireParser,
Object target,
Object[] contextHolder,
Supplier contextSupplier,
@NotNull Method method,
Class<?> parameterType)
Registers a method with the provided WireParser, enabling parsing of wire messages to trigger method invocations.
|
void |
close() |
@NotNull VanillaMethodReader |
closeIn(boolean closeIn)
Control whether
close() also closes the input. |
protected @NotNull MethodWireKey |
createWireKey(@NotNull Method method,
String name)
Creates a MethodWireKey for a given method.
|
protected Object |
invoke(Object target,
@NotNull Method method,
Object[] args)
Invokes a method on an object with the provided arguments.
|
boolean |
isClosed() |
static void |
logMessage(@NotNull CharSequence eventName,
@NotNull ValueIn valueIn)
Write a debug log entry for the incoming event if the debug mode is enabled..
|
net.openhft.chronicle.bytes.MethodReaderInterceptorReturns |
methodReaderInterceptorReturns()
Return the configured
MethodReaderInterceptorReturns if any. |
boolean |
readOne()
Read and dispatch a single message.
|
void |
throwExceptionIfClosed()
Throw
IllegalStateException if this reader has been closed. |
public static final boolean DEBUG_ENABLED
wire.mr.debug. When true, messages are logged via
Jvm.debug() and performance may suffer.@UsedViaReflection public VanillaMethodReader(MarshallableIn in, boolean ignoreDefault, WireParselet defaultParselet, net.openhft.chronicle.bytes.MethodReaderInterceptorReturns methodReaderInterceptorReturns, Object[] metadataHandlers, @NotNull Object... handlers)
in - source of wire messagesignoreDefault - if true default interface methods are skippeddefaultParselet - parselet for unknown eventsmethodReaderInterceptorReturns - optional interceptormetadataHandlers - handlers for metadata messageshandlers - handler instances for data messages@UsedViaReflection public VanillaMethodReader(MarshallableIn in, boolean ignoreDefault, WireParselet defaultParselet, FieldNumberParselet fieldNumberParselet, net.openhft.chronicle.bytes.MethodReaderInterceptorReturns methodReaderInterceptorReturns, @NotNull Object... handlers)
in - source of wire messagesignoreDefault - if true default interface methods are skippeddefaultParselet - parselet for unknown eventsfieldNumberParselet - parselet for numeric idsmethodReaderInterceptorReturns - optional interceptorhandlers - handler instances for data messagespublic VanillaMethodReader(MarshallableIn in, boolean ignoreDefault, WireParselet defaultParselet, FieldNumberParselet fieldNumberParselet, net.openhft.chronicle.bytes.MethodReaderInterceptorReturns methodReaderInterceptorReturns, Object[] metadataHandlers, @NotNull Object... handlers)
in - source of wire messagesignoreDefault - if true default interface methods are skippeddefaultParselet - parselet for unknown eventsfieldNumberParselet - parselet for numeric idsmethodReaderInterceptorReturns - optional interceptormetadataHandlers - handlers for metadata messageshandlers - handler instances for data messagespublic VanillaMethodReader(MarshallableIn in, boolean ignoreDefault, WireParselet defaultParselet, FieldNumberParselet fieldNumberParselet, net.openhft.chronicle.bytes.MethodReaderInterceptorReturns methodReaderInterceptorReturns, Object[] metadataHandlers, Predicate<net.openhft.chronicle.bytes.MethodReader> predicate, @NotNull Object... handlers)
in - source of wire messagesignoreDefault - if true default interface methods are skippeddefaultParselet - parselet for unknown eventsfieldNumberParselet - parselet for numeric idsmethodReaderInterceptorReturns - optional interceptormetadataHandlers - handlers for metadata messagespredicate - predicate controlling readOne executionhandlers - handler instances for data messagespublic static void logMessage(@NotNull
@NotNull CharSequence eventName,
@NotNull
@NotNull ValueIn valueIn)
@NotNull public @NotNull VanillaMethodReader closeIn(boolean closeIn)
close() also closes the input.closeIn in interface net.openhft.chronicle.bytes.MethodReaderpublic void throwExceptionIfClosed()
IllegalStateException if this reader has been closed.public void addParseletForMethod(WireParser wireParser, Object target, Object[] contextHolder, Supplier contextSupplier, @NotNull @NotNull Method method, Class<?> parameterType)
wireParser - The WireParser to which the method will be registeredtarget - The object on which the method should be invokedcontextHolder - The current context for method invocationcontextSupplier - Supplies the context for method invocationmethod - The method to be registeredparameterType - The parameter type of the method being registeredIllegalStateException - if the VanillaMethodReader is closedpublic void addParseletForMethod(WireParser wireParser, Object target, Object[] contextHolder, Supplier contextSupplier, @NotNull @NotNull Method method)
wireParser.@NotNull protected @NotNull MethodWireKey createWireKey(@NotNull @NotNull Method method, String name)
method - The method for which the key is being generatedname - The name of the methodpublic void addParseletForMethod(WireParser wireParser, Object target, Object[] contextHolder, Supplier contextSupplier, @NotNull @NotNull Method method, @NotNull @NotNull Class[] parameterTypes)
wireParser - The WireParser to which the method will be registeredtarget - The object on which the method should be invokedcontextHolder - The current context for method invocationcontextSupplier - Supplies the context for method invocationmethod - The method to be registeredparameterTypes - The array of parameter types for the methodIllegalStateException - if the VanillaMethodReader is closedpublic void addParseletForMethod(WireParser wireParser, Object target, Object[] contextHolder, Supplier contextSupplier, @NotNull @NotNull Method method, @NotNull @NotNull Class[] parameterTypes, MethodFilterOnFirstArg methodFilterOnFirstArg)
wireParser - The WireParser to which the method will be registeredtarget - The object on which the method should be invokedcontextHolder - The current context for method invocationcontextSupplier - Supplies the context for method invocationmethod - The method to be registeredparameterTypes - The array of parameter types for the methodmethodFilterOnFirstArg - The filter that decides if the method should be ignored based on its first argumentIllegalStateException - If the VanillaMethodReader is closedprotected Object invoke(Object target, @NotNull @NotNull Method method, Object[] args) throws net.openhft.chronicle.core.util.InvocationTargetRuntimeException
target - The object on which to invoke the methodmethod - The method to invokeargs - The arguments to pass to the methodnet.openhft.chronicle.core.util.InvocationTargetRuntimeException - if the invoked method itself throws an exceptionpublic boolean readOne()
throws net.openhft.chronicle.core.util.InvocationTargetRuntimeException
readOne in interface net.openhft.chronicle.bytes.MethodReadernet.openhft.chronicle.core.util.InvocationTargetRuntimeExceptionpublic void close()
close in interface Closeableclose in interface AutoCloseablepublic boolean isClosed()
isClosed in interface net.openhft.chronicle.core.io.QueryCloseablepublic net.openhft.chronicle.bytes.MethodReaderInterceptorReturns methodReaderInterceptorReturns()
MethodReaderInterceptorReturns if any.methodReaderInterceptorReturns in interface net.openhft.chronicle.bytes.MethodReaderCopyright © 2026 Chronicle Software Ltd. All rights reserved.