Interface CompactReader
 Read operations might throw HazelcastSerializationException when a
 field with the given name is not found or there is a type mismatch.
 
 The way to use CompactReader for class evolution is to check for the
 existence of a field with its name and kind, with the
 getFieldKind(String) method. One should read the field if it exists
 with the given name and kind, and use some other logic, like using a default
 value, if it does not exist.
 
 public Foo read(CompactReader reader) {
     int bar = reader.readInt32("bar");  // A field that is always present
     String baz;
     if (reader.getFieldKind("baz") == FieldKind.STRING) {
         baz = reader.readString("baz");
     } else {
         baz = ""; // Use a default value, if the field is not present
     }
     return new Foo(bar, baz);
 }
 - Since:
- 5.2
- 
Method SummaryModifier and TypeMethodDescriptiongetFieldKind(String fieldName) Returns the kind of the field for the given field name.boolean[]readArrayOfBoolean(String fieldName) Reads an array of booleans.<T> T[]readArrayOfCompact(String fieldName, Class<T> componentType) Reads an array of compact objects.readArrayOfDate(String fieldName) Reads an array of dates consisting of year, month, and day.readArrayOfDecimal(String fieldName) Reads an array of arbitrary precision and scale floating point numbers.float[]readArrayOfFloat32(String fieldName) Reads an array of 32-bit IEEE 754 floating point numbers.double[]readArrayOfFloat64(String fieldName) Reads an array of 64-bit IEEE 754 floating point numbers.short[]readArrayOfInt16(String fieldName) Reads an array of 16-bit two's complement signed integers.int[]readArrayOfInt32(String fieldName) Reads an array of 32-bit two's complement signed integers.long[]readArrayOfInt64(String fieldName) Reads an array of 64-bit two's complement signed integers.byte[]readArrayOfInt8(String fieldName) Reads an array of 8-bit two's complement signed integers.Boolean[]readArrayOfNullableBoolean(String fieldName) Reads a nullable array of nullable booleans.Float[]readArrayOfNullableFloat32(String fieldName) Reads a nullable array of nullable 32-bit IEEE 754 floating point numbers.Double[]readArrayOfNullableFloat64(String fieldName) Reads a nullable array of nullable 64-bit IEEE 754 floating point numbers.Short[]readArrayOfNullableInt16(String fieldName) Reads a nullable array of nullable 16-bit two's complement signed integers.Integer[]readArrayOfNullableInt32(String fieldName) Reads a nullable array of nullable 32-bit two's complement signed integers.Long[]readArrayOfNullableInt64(String fieldName) Reads a nullable array of nullable 64-bit two's complement signed integers.Byte[]readArrayOfNullableInt8(String fieldName) Reads a nullable array of nullable 8-bit two's complement signed integers.String[]readArrayOfString(String fieldName) Reads an array of UTF-8 encoded strings.readArrayOfTime(String fieldName) Reads an array of times consisting of hour, minute, second, and nanosecondsreadArrayOfTimestamp(String fieldName) Reads an array of timestamps consisting of date and time.readArrayOfTimestampWithTimezone(String fieldName) Reads an array of timestamps with timezone consisting of date, time and timezone offset.booleanreadBoolean(String fieldName) Reads a boolean.<T> TreadCompact(String fieldName) Reads a compact objectReads a date consisting of year, month, and day.readDecimal(String fieldName) Reads an arbitrary precision and scale floating point number.floatreadFloat32(String fieldName) Reads a 32-bit IEEE 754 floating point number.doublereadFloat64(String fieldName) Reads a 64-bit IEEE 754 floating point number.shortReads a 16-bit two's complement signed integer.intReads a 32-bit two's complement signed integer.longReads a 64-bit two's complement signed integer.byteReads an 8-bit two's complement signed integer.readNullableBoolean(String fieldName) Reads a nullable boolean.readNullableFloat32(String fieldName) Reads a nullable 32-bit IEEE 754 floating point number.readNullableFloat64(String fieldName) Reads a nullable 64-bit IEEE 754 floating point number.readNullableInt16(String fieldName) Reads a nullable 16-bit two's complement signed integer.readNullableInt32(String fieldName) Reads a nullable 32-bit two's complement signed integer.readNullableInt64(String fieldName) Reads a nullable 64-bit two's complement signed integer.readNullableInt8(String fieldName) Reads a nullable 8-bit two's complement signed integer.readString(String fieldName) Reads a UTF-8 encoded string.Reads a time consisting of hour, minute, second, and nanoseconds.readTimestamp(String fieldName) Reads a timestamp consisting of date and time.readTimestampWithTimezone(String fieldName) Reads a timestamp with timezone consisting of date, time and timezone offset.
- 
Method Details- 
getFieldKindReturns the kind of the field for the given field name.If the field with the given name does not exist, FieldKind.NOT_AVAILABLEis returned.This method can be used to check the existence of a field, which can be useful when the class is evolved. - Parameters:
- fieldName- name of the field.
- Returns:
- kind of the field
 
- 
readBooleanReads a boolean.This method can also read a nullable boolean, as long as it is not null. If anullvalue is read with this method,HazelcastSerializationExceptionis thrown.- Parameters:
- fieldName- name of the field.
- Returns:
- the value of the field.
- Throws:
- 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.
 
- 
readInt8Reads an 8-bit two's complement signed integer.This method can also read a nullable int8, as long as it is not null. If anullvalue is read with this method,HazelcastSerializationExceptionis thrown.- Parameters:
- fieldName- name of the field.
- Returns:
- the value of the field.
- Throws:
- 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.
 
- 
readInt16Reads a 16-bit two's complement signed integer.This method can also read a nullable int16, as long as it is not null. If anullvalue is read with this method,HazelcastSerializationExceptionis thrown.- Parameters:
- fieldName- name of the field.
- Returns:
- the value of the field.
- Throws:
- 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.
 
- 
readInt32Reads a 32-bit two's complement signed integer.This method can also read a nullable int32, as long as it is not null. If anullvalue is read with this method,HazelcastSerializationExceptionis thrown.- Parameters:
- fieldName- name of the field.
- Returns:
- the value of the field.
- Throws:
- 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.
 
- 
readInt64Reads a 64-bit two's complement signed integer.This method can also read a nullable int64, as long as it is not null. If anullvalue is read with this method,HazelcastSerializationExceptionis thrown.- Parameters:
- fieldName- name of the field.
- Returns:
- the value of the field.
- Throws:
- 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.
 
- 
readFloat32Reads a 32-bit IEEE 754 floating point number.This method can also read a nullable float32, as long as it is not null. If anullvalue is read with this method,HazelcastSerializationExceptionis thrown.- Parameters:
- fieldName- name of the field.
- Returns:
- the value of the field.
- Throws:
- 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.
 
- 
readFloat64Reads a 64-bit IEEE 754 floating point number.This method can also read a nullable float64, as long as it is not null. If anullvalue is read with this method,HazelcastSerializationExceptionis thrown.- Parameters:
- fieldName- name of the field.
- Returns:
- the value of the field.
- Throws:
- 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.
 
- 
readStringReads a UTF-8 encoded string.- Parameters:
- fieldName- name of the field.
- Returns:
- the value of the field.
- Throws:
- 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.
 
- 
readDecimalReads an arbitrary precision and scale floating point number.- Parameters:
- fieldName- name of the field.
- Returns:
- the value of the field.
- Throws:
- 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.
 
- 
readTimeReads a time consisting of hour, minute, second, and nanoseconds.- Parameters:
- fieldName- name of the field.
- Returns:
- the value of the field.
- Throws:
- 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.
 
- 
readDateReads a date consisting of year, month, and day.- Parameters:
- fieldName- name of the field.
- Returns:
- the value of the field.
- Throws:
- 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.
 
- 
readTimestampReads a timestamp consisting of date and time.- Parameters:
- fieldName- name of the field.
- Returns:
- the value of the field.
- Throws:
- 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.
 
- 
readTimestampWithTimezoneReads a timestamp with timezone consisting of date, time and timezone offset.- Parameters:
- fieldName- name of the field.
- Returns:
- the value of the field.
- Throws:
- 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.
 
- 
readCompactReads a compact object- Parameters:
- fieldName- name of the field.
- Returns:
- the value of the field.
- Throws:
- 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.
 
- 
readArrayOfBooleanReads an array of booleans.This method can also read an array of nullable booleans, as long as it does not contain nullvalues. If anullarray item is read with this method,HazelcastSerializationExceptionis thrown.- Parameters:
- fieldName- name of the field.
- Returns:
- the value of the field.
- Throws:
- 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.
 
- 
readArrayOfInt8Reads an array of 8-bit two's complement signed integers.This method can also read an array of nullable int8s, as long as it does not contain nullvalues. If anullarray item is read with this method,HazelcastSerializationExceptionis thrown.- Parameters:
- fieldName- name of the field.
- Returns:
- the value of the field.
- Throws:
- 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.
 
- 
readArrayOfInt16Reads an array of 16-bit two's complement signed integers.This method can also read an array of nullable int16s, as long as it does not contain nullvalues. If anullarray item is read with this method,HazelcastSerializationExceptionis thrown.- Parameters:
- fieldName- name of the field.
- Returns:
- the value of the field.
- Throws:
- 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.
 
- 
readArrayOfInt32Reads an array of 32-bit two's complement signed integers.This method can also read an array of nullable int32s, as long as it does not contain nullvalues. If anullarray item is read with this method,HazelcastSerializationExceptionis thrown.- Parameters:
- fieldName- name of the field.
- Returns:
- the value of the field.
- Throws:
- 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.
 
- 
readArrayOfInt64Reads an array of 64-bit two's complement signed integers.This method can also read an array of nullable int64s, as long as it does not contain nullvalues. If anullarray item is read with this method,HazelcastSerializationExceptionis thrown.- Parameters:
- fieldName- name of the field.
- Returns:
- the value of the field.
- Throws:
- 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.
 
- 
readArrayOfFloat32Reads an array of 32-bit IEEE 754 floating point numbers.This method can also read an array of nullable float32s, as long as it does not contain nullvalues. If anullarray item is read with this method,HazelcastSerializationExceptionis thrown.- Parameters:
- fieldName- name of the field.
- Returns:
- the value of the field.
- Throws:
- 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.
 
- 
readArrayOfFloat64Reads an array of 64-bit IEEE 754 floating point numbers.This method can also read an array of nullable float64s, as long as it does not contain nullvalues. If anullarray item is read with this method,HazelcastSerializationExceptionis thrown.- Parameters:
- fieldName- name of the field.
- Returns:
- the value of the field.
- Throws:
- 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.
 
- 
readArrayOfStringReads an array of UTF-8 encoded strings.- Parameters:
- fieldName- name of the field.
- Returns:
- the value of the field.
- Throws:
- 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.
 
- 
readArrayOfDecimalReads an array of arbitrary precision and scale floating point numbers.- Parameters:
- fieldName- name of the field.
- Returns:
- the value of the field.
- Throws:
- 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.
 
- 
readArrayOfTimeReads an array of times consisting of hour, minute, second, and nanoseconds- Parameters:
- fieldName- name of the field.
- Returns:
- the value of the field. The items in the array cannot be null.
- Throws:
- 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.
 
- 
readArrayOfDateReads an array of dates consisting of year, month, and day.- Parameters:
- fieldName- name of the field.
- Returns:
- the value of the field. The items in the array cannot be null.
- Throws:
- 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.
 
- 
readArrayOfTimestampReads an array of timestamps consisting of date and time.- Parameters:
- fieldName- name of the field.
- Returns:
- the value of the field. The items in the array cannot be null.
- Throws:
- 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.
 
- 
readArrayOfTimestampWithTimezoneReads an array of timestamps with timezone consisting of date, time and timezone offset.- Parameters:
- fieldName- name of the field.
- Returns:
- the value of the field. The items in the array cannot be null.
- Throws:
- 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.
 
- 
readArrayOfCompactReads an array of compact objects.- Parameters:
- fieldName- name of the field.
- Returns:
- the value of the field.
- Throws:
- 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.
 
- 
readNullableBooleanReads a nullable boolean.This method can also read a non-nullable boolean. - Parameters:
- fieldName- name of the field.
- Returns:
- the value of the field.
- Throws:
- 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.
 
- 
readNullableInt8Reads a nullable 8-bit two's complement signed integer.This method can also read a non-nullable int8. - Parameters:
- fieldName- name of the field.
- Returns:
- the value of the field.
- Throws:
- 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.
 
- 
readNullableInt16Reads a nullable 16-bit two's complement signed integer.This method can also read a non-nullable int16. - Parameters:
- fieldName- name of the field.
- Returns:
- the value of the field.
- Throws:
- 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.
 
- 
readNullableInt32Reads a nullable 32-bit two's complement signed integer.This method can also read a non-nullable int32. - Parameters:
- fieldName- name of the field.
- Returns:
- the value of the field.
- Throws:
- 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.
 
- 
readNullableInt64Reads a nullable 64-bit two's complement signed integer.This method can also read a non-nullable int64. - Parameters:
- fieldName- name of the field.
- Returns:
- the value of the field.
- Throws:
- 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.
 
- 
readNullableFloat32Reads a nullable 32-bit IEEE 754 floating point number.This method can also read a non-nullable float32. - Parameters:
- fieldName- name of the field.
- Returns:
- the value of the field.
- Throws:
- 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.
 
- 
readNullableFloat64Reads a nullable 64-bit IEEE 754 floating point number.This method can also read a non-nullable float64. - Parameters:
- fieldName- name of the field.
- Returns:
- the value of the field.
- Throws:
- 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.
 
- 
readArrayOfNullableBooleanReads a nullable array of nullable booleans.This method can also read array of non-nullable booleans. - Parameters:
- fieldName- name of the field.
- Returns:
- the value of the field.
- Throws:
- 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.
 
- 
readArrayOfNullableInt8Reads a nullable array of nullable 8-bit two's complement signed integers.This method can also read array of non-nullable int8s. - Parameters:
- fieldName- name of the field.
- Returns:
- the value of the field.
- Throws:
- 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.
 
- 
readArrayOfNullableInt16Reads a nullable array of nullable 16-bit two's complement signed integers.This method can also read array of non-nullable int16s. - Parameters:
- fieldName- name of the field.
- Returns:
- the value of the field.
- Throws:
- 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.
 
- 
readArrayOfNullableInt32Reads a nullable array of nullable 32-bit two's complement signed integers.This method can also read array of non-nullable int32s. - Parameters:
- fieldName- name of the field.
- Returns:
- the value of the field.
- Throws:
- 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.
 
- 
readArrayOfNullableInt64Reads a nullable array of nullable 64-bit two's complement signed integers.This method can also read array of non-nullable int64s. - Parameters:
- fieldName- name of the field.
- Returns:
- the value of the field.
- Throws:
- 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.
 
- 
readArrayOfNullableFloat32Reads a nullable array of nullable 32-bit IEEE 754 floating point numbers.This method can also read array of non-nullable float32s. - Parameters:
- fieldName- name of the field.
- Returns:
- the value of the field.
- Throws:
- 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.
 
- 
readArrayOfNullableFloat64Reads a nullable array of nullable 64-bit IEEE 754 floating point numbers.This method can also read array of non-nullable float64s. - Parameters:
- fieldName- name of the field.
- Returns:
- the value of the field.
- Throws:
- 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.
 
 
-