@Beta public interface CompactReader
Read operations might throw HazelcastSerializationException
when a field with the given name is not found or there is a type mismatch. On such
occasions, one might provide default values to the read methods to return it in case
of the failure scenarios described above. Providing default values might be especially
useful, if the class might evolve in future, either by adding or removing fields.
Modifier and Type | Method and Description |
---|---|
boolean |
readBoolean(String fieldName)
Reads a boolean.
|
boolean |
readBoolean(String fieldName,
boolean defaultValue)
Reads a boolean or returns the default value.
|
boolean[] |
readBooleanArray(String fieldName)
Reads an array of booleans.
|
boolean[] |
readBooleanArray(String fieldName,
boolean[] defaultValue)
Reads an array of booleans or returns the default value.
|
byte |
readByte(String fieldName)
Reads an 8-bit two's complement signed integer.
|
byte |
readByte(String fieldName,
byte defaultValue)
Reads an 8-bit two's complement signed integer or returns the default value.
|
byte[] |
readByteArray(String fieldName)
Reads an array of 8-bit two's complement signed integers.
|
byte[] |
readByteArray(String fieldName,
byte[] defaultValue)
Reads an array of 8-bit two's complement signed integers
or returns the default value.
|
char |
readChar(String fieldName)
Reads a 16-bit unsigned integer.
|
char |
readChar(String fieldName,
char defaultValue)
Reads a 16-bit unsigned integer or returns the default value.
|
char[] |
readCharArray(String fieldName)
Reads an array of 16-bit unsigned integers.
|
char[] |
readCharArray(String fieldName,
char[] defaultValue)
Reads an array of 16-bit unsigned integers or returns the default value.
|
LocalDate |
readDate(String fieldName)
Reads a date consisting of year, month, and day.
|
LocalDate |
readDate(String fieldName,
LocalDate defaultValue)
Reads a date consisting of year, month, and day or returns the default value.
|
LocalDate[] |
readDateArray(String fieldName)
Reads an array of dates consisting of year, month, and day.
|
LocalDate[] |
readDateArray(String fieldName,
LocalDate[] defaultValue)
Reads an array of dates consisting of year, month, and day
or returns the default value.
|
BigDecimal |
readDecimal(String fieldName)
Reads an arbitrary precision and scale floating point number.
|
BigDecimal |
readDecimal(String fieldName,
BigDecimal defaultValue)
Reads an arbitrary precision and scale floating point number
or returns the default value.
|
BigDecimal[] |
readDecimalArray(String fieldName)
Reads an array of arbitrary precision and scale floating point numbers.
|
BigDecimal[] |
readDecimalArray(String fieldName,
BigDecimal[] defaultValue)
Reads an array of arbitrary precision and scale floating point numbers
or returns the default value.
|
double |
readDouble(String fieldName)
Reads a 64-bit IEEE 754 floating point number.
|
double |
readDouble(String fieldName,
double defaultValue)
Reads a 64-bit IEEE 754 floating point number or returns the default value.
|
double[] |
readDoubleArray(String fieldName)
Reads an array of 64-bit IEEE 754 floating point numbers.
|
double[] |
readDoubleArray(String fieldName,
double[] defaultValue)
Reads an array of 64-bit IEEE 754 floating point numbers
or returns the default value.
|
float |
readFloat(String fieldName)
Reads a 32-bit IEEE 754 floating point number.
|
float |
readFloat(String fieldName,
float defaultValue)
Reads a 32-bit IEEE 754 floating point number or returns the default value.
|
float[] |
readFloatArray(String fieldName)
Reads an array of 32-bit IEEE 754 floating point numbers.
|
float[] |
readFloatArray(String fieldName,
float[] defaultValue)
Reads an array of 32-bit IEEE 754 floating point numbers
or returns the default value.
|
int |
readInt(String fieldName)
Reads a 32-bit two's complement signed integer.
|
int |
readInt(String fieldName,
int defaultValue)
Reads a 32-bit two's complement signed integer or returns the default value.
|
int[] |
readIntArray(String fieldName)
Reads an array of 32-bit two's complement signed integers.
|
int[] |
readIntArray(String fieldName,
int[] defaultValue)
Reads an array of 32-bit two's complement signed integers
or returns the default value.
|
long |
readLong(String fieldName)
Reads a 64-bit two's complement signed integer.
|
long |
readLong(String fieldName,
long defaultValue)
Reads a 64-bit two's complement signed integer or returns the default value.
|
long[] |
readLongArray(String fieldName)
Reads an array of 64-bit two's complement signed integers.
|
long[] |
readLongArray(String fieldName,
long[] defaultValue)
Reads an array of 64-bit two's complement signed integers
or returns the default value.
|
<T> T |
readObject(String fieldName)
Reads an arbitrary object.
|
<T> T |
readObject(String fieldName,
T defaultValue)
Reads an arbitrary object or returns the default value.
|
<T> T[] |
readObjectArray(String fieldName,
Class<T> componentType)
Reads an array of arbitrary objects.
|
<T> T[] |
readObjectArray(String fieldName,
Class<T> componentType,
T[] defaultValue)
Reads an array of arbitrary objects or returns the default value.
|
short |
readShort(String fieldName)
Reads a 16-bit two's complement signed integer.
|
short |
readShort(String fieldName,
short defaultValue)
Reads a 16-bit two's complement signed integer or returns the default value.
|
short[] |
readShortArray(String fieldName)
Reads an array of 16-bit two's complement signed integers.
|
short[] |
readShortArray(String fieldName,
short[] defaultValue)
Reads an array of 16-bit two's complement signed integers
or returns the default value.
|
String |
readString(String fieldName)
Reads an UTF-8 encoded string.
|
String |
readString(String fieldName,
String defaultValue)
Reads an UTF-8 encoded string or returns the default value.
|
String[] |
readStringArray(String fieldName)
Reads an array of UTF-8 encoded strings.
|
String[] |
readStringArray(String fieldName,
String[] defaultValue)
Reads an array of UTF-8 encoded strings or returns the default value.
|
LocalTime |
readTime(String fieldName)
Reads a time consisting of hour, minute, second, and nano seconds.
|
LocalTime |
readTime(String fieldName,
LocalTime defaultValue)
Reads a time consisting of hour, minute, second, and nano seconds
or returns the default value.
|
LocalTime[] |
readTimeArray(String fieldName)
Reads an array of times consisting of hour, minute, second, and nano seconds.
|
LocalTime[] |
readTimeArray(String fieldName,
LocalTime[] defaultValue)
Reads an array of times consisting of hour, minute, second, and nano seconds
or returns the default value.
|
LocalDateTime |
readTimestamp(String fieldName)
Reads a timestamp consisting of date and time.
|
LocalDateTime |
readTimestamp(String fieldName,
LocalDateTime defaultValue)
Reads a timestamp consisting of date and time or returns the default value.
|
LocalDateTime[] |
readTimestampArray(String fieldName)
Reads an array of timestamps consisting of date and time.
|
LocalDateTime[] |
readTimestampArray(String fieldName,
LocalDateTime[] defaultValue)
Reads an array of timestamps consisting of date and time
or returns the default value.
|
OffsetDateTime |
readTimestampWithTimezone(String fieldName)
Reads a timestamp with timezone consisting of date, time and timezone offset.
|
OffsetDateTime |
readTimestampWithTimezone(String fieldName,
OffsetDateTime defaultValue)
Reads a timestamp with timezone consisting of date, time and timezone offset
or returns the default value.
|
OffsetDateTime[] |
readTimestampWithTimezoneArray(String fieldName)
Reads an array of timestamps with timezone consisting of date, time and timezone offset.
|
OffsetDateTime[] |
readTimestampWithTimezoneArray(String fieldName,
OffsetDateTime[] defaultValue)
Reads an array of timestamps with timezone consisting of date, time and timezone offset
or returns the default value.
|
byte readByte(@Nonnull String fieldName)
fieldName
- name of the field.HazelcastSerializationException
- if the field does not exist in the schema
or the type of the field does not match
with the one defined in the schema.byte readByte(@Nonnull String fieldName, byte defaultValue)
fieldName
- name of the field.defaultValue
- default value to return if the field with the given name
does not exist in the schema or the type of the field does
not match with the one defined in the schema.short readShort(@Nonnull String fieldName)
fieldName
- name of the field.HazelcastSerializationException
- if the field does not exist in the schema
or the type of the field does not match
with the one defined in the schema.short readShort(@Nonnull String fieldName, short defaultValue)
fieldName
- name of the field.defaultValue
- default value to return if the field with the given name
does not exist in the schema or the type of the field does
not match with the one defined in the schema.int readInt(@Nonnull String fieldName)
fieldName
- name of the field.HazelcastSerializationException
- if the field does not exist in the schema
or the type of the field does not match
with the one defined in the schema.int readInt(@Nonnull String fieldName, int defaultValue)
fieldName
- name of the field.defaultValue
- default value to return if the field with the given name
does not exist in the schema or the type of the field does
not match with the one defined in the schema.long readLong(@Nonnull String fieldName)
fieldName
- name of the field.HazelcastSerializationException
- if the field does not exist in the schema
or the type of the field does not match
with the one defined in the schema.long readLong(@Nonnull String fieldName, long defaultValue)
fieldName
- name of the field.defaultValue
- default value to return if the field with the given name
does not exist in the schema or the type of the field does
not match with the one defined in the schema.float readFloat(@Nonnull String fieldName)
fieldName
- name of the field.HazelcastSerializationException
- if the field does not exist in the schema
or the type of the field does not match
with the one defined in the schema.float readFloat(@Nonnull String fieldName, float defaultValue)
fieldName
- name of the field.defaultValue
- default value to return if the field with the given name
does not exist in the schema or the type of the field does
not match with the one defined in the schema.double readDouble(@Nonnull String fieldName)
fieldName
- name of the field.HazelcastSerializationException
- if the field does not exist in the schema
or the type of the field does not match
with the one defined in the schema.double readDouble(@Nonnull String fieldName, double defaultValue)
fieldName
- name of the field.defaultValue
- default value to return if the field with the given name
does not exist in the schema or the type of the field does
not match with the one defined in the schema.boolean readBoolean(@Nonnull String fieldName)
fieldName
- name of the field.HazelcastSerializationException
- if the field does not exist in the schema
or the type of the field does not match
with the one defined in the schema.boolean readBoolean(@Nonnull String fieldName, boolean defaultValue)
fieldName
- name of the field.defaultValue
- default value to return if the field with the given name
does not exist in the schema or the type of the field does
not match with the one defined in the schema.char readChar(@Nonnull String fieldName)
fieldName
- name of the field.HazelcastSerializationException
- if the field does not exist in the schema
or the type of the field does not match
with the one defined in the schema.char readChar(@Nonnull String fieldName, char defaultValue)
fieldName
- name of the field.defaultValue
- default value to return if the field with the given name
does not exist in the schema or the type of the field does
not match with the one defined in the schema.@Nullable String readString(@Nonnull String fieldName)
fieldName
- name of the field.HazelcastSerializationException
- if the field does not exist in the schema
or the type of the field does not match
with the one defined in the schema.@Nullable String readString(@Nonnull String fieldName, @Nullable String defaultValue)
fieldName
- name of the field.defaultValue
- default value to return if the field with the given name
does not exist in the schema or the type of the field does
not match with the one defined in the schema.@Nullable BigDecimal readDecimal(@Nonnull String fieldName)
fieldName
- name of the field.HazelcastSerializationException
- if the field does not exist in the schema
or the type of the field does not match
with the one defined in the schema.@Nullable BigDecimal readDecimal(@Nonnull String fieldName, @Nullable BigDecimal defaultValue)
fieldName
- name of the field.defaultValue
- default value to return if the field with the given name
does not exist in the schema or the type of the field does
not match with the one defined in the schema.@Nonnull LocalTime readTime(@Nonnull String fieldName)
fieldName
- name of the field.HazelcastSerializationException
- if the field does not exist in the schema
or the type of the field does not match
with the one defined in the schema.@Nullable LocalTime readTime(@Nonnull String fieldName, @Nullable LocalTime defaultValue)
This method may only return null
, if the defaultValue
is null
.
fieldName
- name of the field.defaultValue
- default value to return if the field with the given name
does not exist in the schema or the type of the field does
not match with the one defined in the schema.@Nonnull LocalDate readDate(@Nonnull String fieldName)
fieldName
- name of the field.HazelcastSerializationException
- if the field does not exist in the schema
or the type of the field does not match
with the one defined in the schema.@Nullable LocalDate readDate(@Nonnull String fieldName, @Nullable LocalDate defaultValue)
This method may only return null
, if the defaultValue
is null
.
fieldName
- name of the field.defaultValue
- default value to return if the field with the given name
does not exist in the schema or the type of the field does
not match with the one defined in the schema.@Nonnull LocalDateTime readTimestamp(@Nonnull String fieldName)
fieldName
- name of the field.HazelcastSerializationException
- if the field does not exist in the schema
or the type of the field does not match
with the one defined in the schema.@Nullable LocalDateTime readTimestamp(@Nonnull String fieldName, @Nullable LocalDateTime defaultValue)
This method may only return null
, if the defaultValue
is null
.
fieldName
- name of the field.defaultValue
- default value to return if the field with the given name
does not exist in the schema or the type of the field does
not match with the one defined in the schema.@Nonnull OffsetDateTime readTimestampWithTimezone(@Nonnull String fieldName)
fieldName
- name of the field.HazelcastSerializationException
- if the field does not exist in the schema
or the type of the field does not match
with the one defined in the schema.@Nullable OffsetDateTime readTimestampWithTimezone(@Nonnull String fieldName, @Nullable OffsetDateTime defaultValue)
This method may only return null
, if the defaultValue
is null
.
fieldName
- name of the field.defaultValue
- default value to return if the field with the given name
does not exist in the schema or the type of the field does
not match with the one defined in the schema.@Nullable <T> T readObject(@Nonnull String fieldName)
fieldName
- name of the field.HazelcastSerializationException
- if the field does not exist in the schema
or the type of the field does not match
with the one defined in the schema.HazelcastException
- if the object cannot be created.@Nullable <T> T readObject(@Nonnull String fieldName, @Nullable T defaultValue)
fieldName
- name of the field.defaultValue
- default value to return if the field with the given name
does not exist in the schema or the type of the field does
not match with the one defined in the schema.HazelcastException
- if the object cannot be created.@Nullable byte[] readByteArray(@Nonnull String fieldName)
fieldName
- name of the field.HazelcastSerializationException
- if the field does not exist in the schema
or the type of the field does not match
with the one defined in the schema.@Nullable byte[] readByteArray(@Nonnull String fieldName, @Nullable byte[] defaultValue)
fieldName
- name of the field.defaultValue
- default value to return if the field with the given name
does not exist in the schema or the type of the field does
not match with the one defined in the schema.@Nullable boolean[] readBooleanArray(@Nonnull String fieldName)
fieldName
- name of the field.HazelcastSerializationException
- if the field does not exist in the schema
or the type of the field does not match
with the one defined in the schema.@Nullable boolean[] readBooleanArray(@Nonnull String fieldName, @Nullable boolean[] defaultValue)
fieldName
- name of the field.defaultValue
- default value to return if the field with the given name
does not exist in the schema or the type of the field does
not match with the one defined in the schema.@Nullable char[] readCharArray(@Nonnull String fieldName)
fieldName
- name of the field.HazelcastSerializationException
- if the field does not exist in the schema
or the type of the field does not match
with the one defined in the schema.@Nullable char[] readCharArray(@Nonnull String fieldName, @Nullable char[] defaultValue)
fieldName
- name of the field.defaultValue
- default value to return if the field with the given name
does not exist in the schema or the type of the field does
not match with the one defined in the schema.@Nullable int[] readIntArray(@Nonnull String fieldName)
fieldName
- name of the field.HazelcastSerializationException
- if the field does not exist in the schema
or the type of the field does not match
with the one defined in the schema.@Nullable int[] readIntArray(@Nonnull String fieldName, @Nullable int[] defaultValue)
fieldName
- name of the field.defaultValue
- default value to return if the field with the given name
does not exist in the schema or the type of the field does
not match with the one defined in the schema.@Nullable long[] readLongArray(@Nonnull String fieldName)
fieldName
- name of the field.HazelcastSerializationException
- if the field does not exist in the schema
or the type of the field does not match
with the one defined in the schema.@Nullable long[] readLongArray(@Nonnull String fieldName, @Nullable long[] defaultValue)
fieldName
- name of the field.defaultValue
- default value to return if the field with the given name
does not exist in the schema or the type of the field does
not match with the one defined in the schema.@Nullable double[] readDoubleArray(@Nonnull String fieldName)
fieldName
- name of the field.HazelcastSerializationException
- if the field does not exist in the schema
or the type of the field does not match
with the one defined in the schema.@Nullable double[] readDoubleArray(@Nonnull String fieldName, @Nullable double[] defaultValue)
fieldName
- name of the field.defaultValue
- default value to return if the field with the given name
does not exist in the schema or the type of the field does
not match with the one defined in the schema.@Nullable float[] readFloatArray(@Nonnull String fieldName)
fieldName
- name of the field.HazelcastSerializationException
- if the field does not exist in the schema
or the type of the field does not match
with the one defined in the schema.@Nullable float[] readFloatArray(@Nonnull String fieldName, @Nullable float[] defaultValue)
fieldName
- name of the field.defaultValue
- default value to return if the field with the given name
does not exist in the schema or the type of the field does
not match with the one defined in the schema.@Nullable short[] readShortArray(@Nonnull String fieldName)
fieldName
- name of the field.HazelcastSerializationException
- if the field does not exist in the schema
or the type of the field does not match
with the one defined in the schema.@Nullable short[] readShortArray(@Nonnull String fieldName, @Nullable short[] defaultValue)
fieldName
- name of the field.defaultValue
- default value to return if the field with the given name
does not exist in the schema or the type of the field does
not match with the one defined in the schema.@Nullable String[] readStringArray(@Nonnull String fieldName)
fieldName
- name of the field.HazelcastSerializationException
- if the field does not exist in the schema
or the type of the field does not match
with the one defined in the schema.@Nullable String[] readStringArray(@Nonnull String fieldName, @Nullable String[] defaultValue)
fieldName
- name of the field.defaultValue
- default value to return if the field with the given name
does not exist in the schema or the type of the field does
not match with the one defined in the schema.@Nullable BigDecimal[] readDecimalArray(@Nonnull String fieldName)
fieldName
- name of the field.HazelcastSerializationException
- if the field does not exist in the schema
or the type of the field does not match
with the one defined in the schema.@Nullable BigDecimal[] readDecimalArray(@Nonnull String fieldName, @Nullable BigDecimal[] defaultValue)
fieldName
- name of the field.defaultValue
- default value to return if the field with the given name
does not exist in the schema or the type of the field does
not match with the one defined in the schema.@Nullable LocalTime[] readTimeArray(@Nonnull String fieldName)
fieldName
- name of the field.HazelcastSerializationException
- if the field does not exist in the schema
or the type of the field does not match
with the one defined in the schema.@Nullable LocalTime[] readTimeArray(@Nonnull String fieldName, @Nullable LocalTime[] defaultValue)
fieldName
- name of the field.defaultValue
- default value to return if the field with the given name
does not exist in the schema or the type of the field does
not match with the one defined in the schema.defaultValue
.@Nullable LocalDate[] readDateArray(@Nonnull String fieldName)
fieldName
- name of the field.HazelcastSerializationException
- if the field does not exist in the schema
or the type of the field does not match
with the one defined in the schema.@Nullable LocalDate[] readDateArray(@Nonnull String fieldName, @Nullable LocalDate[] defaultValue)
fieldName
- name of the field.defaultValue
- default value to return if the field with the given name
does not exist in the schema or the type of the field does
not match with the one defined in the schema.defaultValue
.@Nullable LocalDateTime[] readTimestampArray(@Nonnull String fieldName)
fieldName
- name of the field.HazelcastSerializationException
- if the field does not exist in the schema
or the type of the field does not match
with the one defined in the schema.@Nullable LocalDateTime[] readTimestampArray(@Nonnull String fieldName, @Nullable LocalDateTime[] defaultValue)
fieldName
- name of the field.defaultValue
- default value to return if the field with the given name
does not exist in the schema or the type of the field does
not match with the one defined in the schema.defaultValue
.@Nullable OffsetDateTime[] readTimestampWithTimezoneArray(@Nonnull String fieldName)
fieldName
- name of the field.HazelcastSerializationException
- if the field does not exist in the schema
or the type of the field does not match
with the one defined in the schema.@Nullable OffsetDateTime[] readTimestampWithTimezoneArray(@Nonnull String fieldName, @Nullable OffsetDateTime[] defaultValue)
fieldName
- name of the field.defaultValue
- default value to return if the field with the given name
does not exist in the schema or the type of the field does
not match with the one defined in the schema.defaultValue
.@Nullable <T> T[] readObjectArray(@Nonnull String fieldName, @Nullable Class<T> componentType)
fieldName
- name of the field.HazelcastSerializationException
- if the field does not exist in the schema
or the type of the field does not match
with the one defined in the schema.@Nullable <T> T[] readObjectArray(@Nonnull String fieldName, @Nullable Class<T> componentType, T[] defaultValue)
fieldName
- name of the field.defaultValue
- default value to return if the field with the given name
does not exist in the schema or the type of the field does
not match with the one defined in the schema.Copyright © 2023 Hazelcast, Inc.. All rights reserved.