public class VanillaMethodWriterBuilder<T> extends Object implements net.openhft.chronicle.core.util.Builder<T>, net.openhft.chronicle.bytes.MethodWriterBuilder<T>
MarshallableOut.
The writer attempts to generate and compile a dedicated implementation for
the configured interfaces. If generation is disabled or fails it falls back to
a standard Proxy.
Options include additional interfaces, generic event handling and update
interceptors. By default a thread-local invocation handler is used but this
can be overridden via disableThreadSafe(boolean).
| Modifier and Type | Field and Description |
|---|---|
static String |
DISABLE_WRITER_PROXY_CODEGEN |
| Constructor and Description |
|---|
VanillaMethodWriterBuilder(@NotNull Class<T> tClass,
WireType wireType,
@NotNull Supplier<net.openhft.chronicle.bytes.MethodWriterInvocationHandler> handlerSupplier)
Constructs an instance of VanillaMethodWriterBuilder with the specified class type, wire type,
and an invocation handler supplier.
|
| Modifier and Type | Method and Description |
|---|---|
@NotNull net.openhft.chronicle.bytes.MethodWriterBuilder<T> |
addInterface(Class<?> additionalClass)
Adds an interface to the set of interfaces managed by this builder.
|
T |
build()
Builds the method writer proxy.
|
@NotNull net.openhft.chronicle.bytes.MethodWriterBuilder<T> |
classLoader(ClassLoader classLoader)
Configures the class loader to be used for dynamic class generation and loading.
|
@NotNull net.openhft.chronicle.bytes.MethodWriterBuilder<T> |
disableThreadSafe(boolean theadSafe)
Controls whether the same invocation handler instance can be reused across threads.
|
net.openhft.chronicle.bytes.MethodWriterBuilder<T> |
genericEvent(String genericEvent)
A generic event treats the first argument as the eventName
|
T |
get()
Returns the method writer proxy instance.
|
net.openhft.chronicle.bytes.MethodWriterBuilder<T> |
marshallableOut(@NotNull MarshallableOut out)
Sends method calls to the given
MarshallableOut. |
net.openhft.chronicle.bytes.MethodWriterBuilder<T> |
marshallableOutSupplier(@NotNull Supplier<MarshallableOut> out)
Uses a supplier to obtain the
MarshallableOut for each call. |
net.openhft.chronicle.bytes.MethodWriterBuilder<T> |
metaData(boolean metaData)
Specifies whether the builder should include metadata or not.
|
@NotNull net.openhft.chronicle.bytes.MethodWriterBuilder<T> |
onClose(net.openhft.chronicle.core.io.Closeable closeable)
Registers a closeable resource with the method writer invocation handler.
|
Class<?> |
proxyClass() |
net.openhft.chronicle.bytes.MethodWriterBuilder<T> |
proxyClass(Class<?> proxyClass)
Sets the proxy class to be used by the builder.
|
@NotNull net.openhft.chronicle.bytes.MethodWriterBuilder<T> |
updateInterceptor(net.openhft.chronicle.bytes.UpdateInterceptor updateInterceptor)
Sets an
UpdateInterceptor to be invoked before each method call. |
@NotNull net.openhft.chronicle.bytes.MethodWriterBuilder<T> |
verboseTypes(boolean verboseTypes) |
WireType |
wireType() |
VanillaMethodWriterBuilder<T> |
wireType(WireType wireType)
Sets the
WireType used by the generated writer. |
public static final String DISABLE_WRITER_PROXY_CODEGEN
public VanillaMethodWriterBuilder(@NotNull
@NotNull Class<T> tClass,
WireType wireType,
@NotNull
@NotNull Supplier<net.openhft.chronicle.bytes.MethodWriterInvocationHandler> handlerSupplier)
tClass - The class type that the builder will be working on.wireType - The wire type to be used for the method writer.handlerSupplier - Supplier to provide invocation handlers for the method writer.@NotNull public @NotNull net.openhft.chronicle.bytes.MethodWriterBuilder<T> classLoader(ClassLoader classLoader)
classLoader - The class loader to be set.@NotNull public @NotNull net.openhft.chronicle.bytes.MethodWriterBuilder<T> updateInterceptor(net.openhft.chronicle.bytes.UpdateInterceptor updateInterceptor)
UpdateInterceptor to be invoked before each method call.
The interceptor may veto the call by returning false.updateInterceptor in interface net.openhft.chronicle.bytes.MethodWriterBuilder<T>@NotNull public @NotNull net.openhft.chronicle.bytes.MethodWriterBuilder<T> verboseTypes(boolean verboseTypes)
verboseTypes in interface net.openhft.chronicle.bytes.MethodWriterBuilder<T>@NotNull public @NotNull net.openhft.chronicle.bytes.MethodWriterBuilder<T> addInterface(Class<?> additionalClass)
invalidSuperInterfaces) and adds it to the internal collection. Additionally, it
recursively processes return types of the methods in the provided interface and adds them
if they are also interfaces.additionalClass - The interface to be added.IllegalArgumentException - if the provided interface is deemed invalid.@NotNull public @NotNull net.openhft.chronicle.bytes.MethodWriterBuilder<T> disableThreadSafe(boolean theadSafe)
true a single non-thread-safe handler may be shared.@NotNull public T build()
Proxy if generation is disabled or fails.build in interface net.openhft.chronicle.bytes.MethodWriterBuilder<T>build in interface net.openhft.chronicle.core.util.Builder<T>TNullPointerException - if marshallableOut(MarshallableOut) was not configured@NotNull public @NotNull net.openhft.chronicle.bytes.MethodWriterBuilder<T> onClose(net.openhft.chronicle.core.io.Closeable closeable)
onClose in interface net.openhft.chronicle.bytes.MethodWriterBuilder<T>closeable - The closeable resource to be registered.public VanillaMethodWriterBuilder<T> wireType(WireType wireType)
WireType used by the generated writer.@NotNull public T get()
Proxy.public net.openhft.chronicle.bytes.MethodWriterBuilder<T> genericEvent(String genericEvent)
genericEvent in interface net.openhft.chronicle.bytes.MethodWriterBuilder<T>genericEvent - namepublic net.openhft.chronicle.bytes.MethodWriterBuilder<T> marshallableOut(@NotNull @NotNull MarshallableOut out)
MarshallableOut.public net.openhft.chronicle.bytes.MethodWriterBuilder<T> marshallableOutSupplier(@NotNull @NotNull Supplier<MarshallableOut> out)
MarshallableOut for each call.public net.openhft.chronicle.bytes.MethodWriterBuilder<T> metaData(boolean metaData)
metaData in interface net.openhft.chronicle.bytes.MethodWriterBuilder<T>metaData - A boolean indicating whether to include metadata.MethodWriterBuilder, allowing chained method calls.public Class<?> proxyClass()
public net.openhft.chronicle.bytes.MethodWriterBuilder<T> proxyClass(Class<?> proxyClass)
proxyClass - The class to be set as the proxy class.MethodWriterBuilder, allowing chained method calls.IllegalArgumentException - If the provided class is an interface.Copyright © 2026 Chronicle Software Ltd. All rights reserved.