T - the type of the object to be marshaled.public class BytesMarshaller<T> extends Object
FieldAccess for
actual field value extraction and setting.
This class also provides a method for extracting all fields from a class and its superclasses (except transient and static fields). All the fields are made accessible even if they are private, and are then stored in a map for future access.
Note: This class suppresses rawtypes and unchecked warnings.
| Modifier and Type | Field and Description |
|---|---|
static net.openhft.chronicle.core.util.ClassLocal<BytesMarshaller> |
BYTES_MARSHALLER_CL
Provides a ClassLocal instance for holding a unique BytesMarshaller for each class.
|
| Constructor and Description |
|---|
BytesMarshaller(@NotNull Class<T> tClass)
Constructs a BytesMarshaller for the specified class.
|
| Modifier and Type | Method and Description |
|---|---|
static void |
getAllField(@NotNull Class<?> clazz,
@NotNull Map<String,Field> map)
Extracts all fields from the specified class and its superclasses and stores
them in the provided map.
|
void |
readMarshallable(ReadBytesMarshallable t,
BytesIn<?> in)
Reads the state of the given ReadBytesMarshallable object from the specified BytesIn.
|
void |
writeMarshallable(WriteBytesMarshallable t,
BytesOut<?> out)
Writes the state of the given WriteBytesMarshallable object to the specified BytesOut.
|
public static final net.openhft.chronicle.core.util.ClassLocal<BytesMarshaller> BYTES_MARSHALLER_CL
public static void getAllField(@NotNull
@NotNull Class<?> clazz,
@NotNull
@NotNull Map<String,Field> map)
clazz - the class from which to extract fields.map - the map in which to store the fields.public void readMarshallable(ReadBytesMarshallable t, BytesIn<?> in) throws net.openhft.chronicle.core.io.InvalidMarshallableException
t - the object to read into.in - the BytesIn from which to read.net.openhft.chronicle.core.io.InvalidMarshallableException - If the object cannot be read due to invalid data.public void writeMarshallable(WriteBytesMarshallable t, BytesOut<?> out) throws IllegalArgumentException, net.openhft.chronicle.core.io.ClosedIllegalStateException, BufferOverflowException, BufferUnderflowException, ArithmeticException, net.openhft.chronicle.core.io.InvalidMarshallableException, net.openhft.chronicle.core.io.ThreadingIllegalStateException
t - the object to write.out - the BytesOut to which to write.IllegalArgumentException - If a method is invoked with an illegal or inappropriate argument.net.openhft.chronicle.core.io.ClosedIllegalStateException - If the resource has been released or closed.net.openhft.chronicle.core.io.ThreadingIllegalStateException - If this resource was accessed by multiple threads in an unsafe wayBufferOverflowException - If there is not enough space in the buffer.BufferUnderflowException - If there is not enough data available in the buffer.ArithmeticException - If there is an arithmetic error.net.openhft.chronicle.core.io.InvalidMarshallableException - If the object cannot be written due to invalid data.Copyright © 2024. All rights reserved.