@Beta public interface GenericRecordBuilder
GenericRecord
instances.Modifier and Type | Method and Description |
---|---|
GenericRecord |
build() |
static GenericRecordBuilder |
portable(ClassDefinition classDefinition)
Creates a Builder that will build a
GenericRecord in Portable format with a new class definition: |
GenericRecordBuilder |
setBoolean(String fieldName,
boolean value)
It is legal to set the field again only when Builder is created with
GenericRecord.cloneWithBuilder() . |
GenericRecordBuilder |
setBooleanArray(String fieldName,
boolean[] value)
It is legal to set the field again only when Builder is created with
GenericRecord.cloneWithBuilder() . |
GenericRecordBuilder |
setByte(String fieldName,
byte value)
It is legal to set the field again only when Builder is created with
GenericRecord.cloneWithBuilder() . |
GenericRecordBuilder |
setByteArray(String fieldName,
byte[] value)
It is legal to set the field again only when Builder is created with
GenericRecord.cloneWithBuilder() . |
GenericRecordBuilder |
setChar(String fieldName,
char value)
It is legal to set the field again only when Builder is created with
GenericRecord.cloneWithBuilder() . |
GenericRecordBuilder |
setCharArray(String fieldName,
char[] value)
It is legal to set the field again only when Builder is created with
GenericRecord.cloneWithBuilder() . |
GenericRecordBuilder |
setDate(String fieldName,
LocalDate value)
Sets a date field consisting of year , month of the year and day of the month
It is legal to set the field again only when Builder is created with
GenericRecord.cloneWithBuilder() . |
GenericRecordBuilder |
setDateArray(String fieldName,
LocalDate[] value)
Sets an array of Date's
It is legal to set the field again only when Builder is created with
GenericRecord.cloneWithBuilder() . |
GenericRecordBuilder |
setDecimal(String fieldName,
BigDecimal value)
Sets a decimal which is arbitrary precision and scale floating-point number
It is legal to set the field again only when Builder is created with
GenericRecord.cloneWithBuilder() . |
GenericRecordBuilder |
setDecimalArray(String fieldName,
BigDecimal[] value)
Sets an array of Decimals
It is legal to set the field again only when Builder is created with
GenericRecord.cloneWithBuilder() . |
GenericRecordBuilder |
setDouble(String fieldName,
double value)
It is legal to set the field again only when Builder is created with
GenericRecord.cloneWithBuilder() . |
GenericRecordBuilder |
setDoubleArray(String fieldName,
double[] value)
It is legal to set the field again only when Builder is created with
GenericRecord.cloneWithBuilder() . |
GenericRecordBuilder |
setFloat(String fieldName,
float value)
It is legal to set the field again only when Builder is created with
GenericRecord.cloneWithBuilder() . |
GenericRecordBuilder |
setFloatArray(String fieldName,
float[] value)
It is legal to set the field again only when Builder is created with
GenericRecord.cloneWithBuilder() . |
GenericRecordBuilder |
setGenericRecord(String fieldName,
GenericRecord value)
It is legal to set the field again only when Builder is created with
GenericRecord.cloneWithBuilder() . |
GenericRecordBuilder |
setGenericRecordArray(String fieldName,
GenericRecord[] value)
It is legal to set the field again only when Builder is created with
GenericRecord.cloneWithBuilder() . |
GenericRecordBuilder |
setInt(String fieldName,
int value)
It is legal to set the field again only when Builder is created with
GenericRecord.cloneWithBuilder() . |
GenericRecordBuilder |
setIntArray(String fieldName,
int[] value)
It is legal to set the field again only when Builder is created with
GenericRecord.cloneWithBuilder() . |
GenericRecordBuilder |
setLong(String fieldName,
long value)
It is legal to set the field again only when Builder is created with
GenericRecord.cloneWithBuilder() . |
GenericRecordBuilder |
setLongArray(String fieldName,
long[] value)
It is legal to set the field again only when Builder is created with
GenericRecord.cloneWithBuilder() . |
GenericRecordBuilder |
setShort(String fieldName,
short value)
It is legal to set the field again only when Builder is created with
GenericRecord.cloneWithBuilder() . |
GenericRecordBuilder |
setShortArray(String fieldName,
short[] value)
It is legal to set the field again only when Builder is created with
GenericRecord.cloneWithBuilder() . |
GenericRecordBuilder |
setString(String fieldName,
String value)
It is legal to set the field again only when Builder is created with
GenericRecord.cloneWithBuilder() . |
GenericRecordBuilder |
setStringArray(String fieldName,
String[] value)
It is legal to set the field again only when Builder is created with
GenericRecord.cloneWithBuilder() . |
GenericRecordBuilder |
setTime(String fieldName,
LocalTime value)
Sets a time field consisting of hour, minute, seconds and nanos parts
It is legal to set the field again only when Builder is created with
GenericRecord.cloneWithBuilder() . |
GenericRecordBuilder |
setTimeArray(String fieldName,
LocalTime[] value)
Sets an array of Time's
It is legal to set the field again only when Builder is created with
GenericRecord.cloneWithBuilder() . |
GenericRecordBuilder |
setTimestamp(String fieldName,
LocalDateTime value)
Sets a timestamp field consisting of
year , month of the year and day of the month, hour, minute, seconds, nanos parts
It is legal to set the field again only when Builder is created with
GenericRecord.cloneWithBuilder() . |
GenericRecordBuilder |
setTimestampArray(String fieldName,
LocalDateTime[] value)
Sets an array of Timestamp's
It is legal to set the field again only when Builder is created with
GenericRecord.cloneWithBuilder() . |
GenericRecordBuilder |
setTimestampWithTimezone(String fieldName,
OffsetDateTime value)
Sets a timestamp with timezone field consisting of
year , month of the year and day of the month, offset seconds , hour, minute, seconds, nanos parts
It is legal to set the field again only when Builder is created with
GenericRecord.cloneWithBuilder() . |
GenericRecordBuilder |
setTimestampWithTimezoneArray(String fieldName,
OffsetDateTime[] value)
Sets an array of TimestampWithTimezone's
It is legal to set the field again only when Builder is created with
GenericRecord.cloneWithBuilder() . |
@Nonnull static GenericRecordBuilder portable(@Nonnull ClassDefinition classDefinition)
GenericRecord
in Portable
format with a new class definition:
ClassDefinition classDefinition = new ClassDefinitionBuilder(FACTORY_ID, CLASS_ID) .addStringField("name").addIntField("id").build(); GenericRecord genericRecord = GenericRecord.Builder.portable(classDefinition) .setString("name", "foo") .setInt("id", 123).build();
classDefinition
- of the portable that we will create@Nonnull GenericRecord build()
HazelcastSerializationException
- when the GenericRecord cannot be build.@Nonnull GenericRecordBuilder setBoolean(@Nonnull String fieldName, boolean value)
GenericRecord.cloneWithBuilder()
.
Otherwise, it is illegal to set to the same field twice.fieldName
- name of the field as it is defined in its class definition.
It should be composed of only alpha-numeric characters.
See ClassDefinition
for Portable
value
- to set to GenericRecordHazelcastSerializationException
- if the field name does not exist in the class definition or
the type of the field does not match the one in the class definition or
Same field is trying to be set without using
GenericRecord.cloneWithBuilder()
.@Nonnull GenericRecordBuilder setByte(@Nonnull String fieldName, byte value)
GenericRecord.cloneWithBuilder()
.
Otherwise, it is illegal to set to the same field twice.fieldName
- name of the field as it is defined in its class definition.
It should be composed of only alpha-numeric characters.
See ClassDefinition
for Portable
value
- to set to GenericRecordHazelcastSerializationException
- if the field name does not exist in the class definition or
the type of the field does not match the one in the class definition or
Same field is trying to be set without using
GenericRecord.cloneWithBuilder()
.@Nonnull GenericRecordBuilder setChar(@Nonnull String fieldName, char value)
GenericRecord.cloneWithBuilder()
.
Otherwise, it is illegal to set to the same field twice.fieldName
- name of the field as it is defined in its class definition.
See ClassDefinition
for Portable
value
- to set to GenericRecordHazelcastSerializationException
- if the field name does not exist in the class definition or
the type of the field does not match the one in the class definition or
Same field is trying to be set without using
GenericRecord.cloneWithBuilder()
.@Nonnull GenericRecordBuilder setDouble(@Nonnull String fieldName, double value)
GenericRecord.cloneWithBuilder()
.
Otherwise, it is illegal to set to the same field twice.fieldName
- name of the field as it is defined in its class definition.
See ClassDefinition
for Portable
value
- to set to GenericRecordHazelcastSerializationException
- if the field name does not exist in the class definition or
the type of the field does not match the one in the class definition or
Same field is trying to be set without using
GenericRecord.cloneWithBuilder()
.@Nonnull GenericRecordBuilder setFloat(@Nonnull String fieldName, float value)
GenericRecord.cloneWithBuilder()
.
Otherwise, it is illegal to set to the same field twice.fieldName
- name of the field as it is defined in its class definition.
See ClassDefinition
for Portable
value
- to set to GenericRecordHazelcastSerializationException
- if the field name does not exist in the class definition or
the type of the field does not match the one in the class definition or
Same field is trying to be set without using
GenericRecord.cloneWithBuilder()
.@Nonnull GenericRecordBuilder setInt(@Nonnull String fieldName, int value)
GenericRecord.cloneWithBuilder()
.
Otherwise, it is illegal to set to the same field twice.fieldName
- name of the field as it is defined in its class definition.
See ClassDefinition
for Portable
value
- to set to GenericRecordHazelcastSerializationException
- if the field name does not exist in the class definition or
the type of the field does not match the one in the class definition or
Same field is trying to be set without using
GenericRecord.cloneWithBuilder()
.@Nonnull GenericRecordBuilder setLong(@Nonnull String fieldName, long value)
GenericRecord.cloneWithBuilder()
.
Otherwise, it is illegal to set to the same field twice.fieldName
- name of the field as it is defined in its class definition.
See ClassDefinition
for Portable
value
- to set to GenericRecordHazelcastSerializationException
- if the field name does not exist in the class definition or
the type of the field does not match the one in the class definition or
Same field is trying to be set without using
GenericRecord.cloneWithBuilder()
.@Nonnull GenericRecordBuilder setShort(@Nonnull String fieldName, short value)
GenericRecord.cloneWithBuilder()
.
Otherwise, it is illegal to set to the same field twice.fieldName
- name of the field as it is defined in its class definition.
See ClassDefinition
for Portable
value
- to set to GenericRecordHazelcastSerializationException
- if the field name does not exist in the class definition or
the type of the field does not match the one in the class definition or
Same field is trying to be set without using
GenericRecord.cloneWithBuilder()
.@Nonnull GenericRecordBuilder setString(@Nonnull String fieldName, @Nullable String value)
GenericRecord.cloneWithBuilder()
.
Otherwise, it is illegal to set to the same field twice.fieldName
- name of the field as it is defined in its class definition.
See ClassDefinition
for Portable
value
- to set to GenericRecordHazelcastSerializationException
- if the field name does not exist in the class definition or
the type of the field does not match the one in the class definition or
Same field is trying to be set without using
GenericRecord.cloneWithBuilder()
.@Nonnull GenericRecordBuilder setGenericRecord(@Nonnull String fieldName, @Nullable GenericRecord value)
GenericRecord.cloneWithBuilder()
.
Otherwise, it is illegal to set to the same field twice.
This method allows nested structures. Subclass should also created as `GenericRecord`.fieldName
- name of the field as it is defined in its class definition.
See ClassDefinition
for Portable
value
- to set to GenericRecordHazelcastSerializationException
- if the field name does not exist in the class definition or
the type of the field does not match the one in the class definition or
Same field is trying to be set without using
GenericRecord.cloneWithBuilder()
.@Nonnull GenericRecordBuilder setDecimal(@Nonnull String fieldName, @Nullable BigDecimal value)
GenericRecord.cloneWithBuilder()
.
Otherwise, it is illegal to set to the same field twice.fieldName
- name of the field as it is defined in its class definition.
See ClassDefinition
for Portable
value
- to set to GenericRecordHazelcastSerializationException
- if the field name does not exist in the class definition or
the type of the field does not match the one in the class definition or
Same field is trying to be set without using
GenericRecord.cloneWithBuilder()
.@Nonnull GenericRecordBuilder setTime(@Nonnull String fieldName, @Nullable LocalTime value)
GenericRecord.cloneWithBuilder()
.
Otherwise, it is illegal to set to the same field twice.fieldName
- name of the field as it is defined in its class definition.
See ClassDefinition
for Portable
value
- to set to GenericRecordHazelcastSerializationException
- if the field name does not exist in the class definition or
the type of the field does not match the one in the class definition or
Same field is trying to be set without using
GenericRecord.cloneWithBuilder()
.@Nonnull GenericRecordBuilder setDate(@Nonnull String fieldName, @Nullable LocalDate value)
GenericRecord.cloneWithBuilder()
.
Otherwise, it is illegal to set to the same field twice.fieldName
- name of the field as it is defined in its class definition.
See ClassDefinition
for Portable
value
- to set to GenericRecordHazelcastSerializationException
- if the field name does not exist in the class definition or
the type of the field does not match the one in the class definition or
Same field is trying to be set without using
GenericRecord.cloneWithBuilder()
.@Nonnull GenericRecordBuilder setTimestamp(@Nonnull String fieldName, @Nullable LocalDateTime value)
GenericRecord.cloneWithBuilder()
.
Otherwise, it is illegal to set to the same field twice.fieldName
- name of the field as it is defined in its class definition.
See ClassDefinition
for Portable
value
- to set to GenericRecordHazelcastSerializationException
- if the field name does not exist in the class definition or
the type of the field does not match the one in the class definition or
Same field is trying to be set without using
GenericRecord.cloneWithBuilder()
.@Nonnull GenericRecordBuilder setTimestampWithTimezone(@Nonnull String fieldName, @Nullable OffsetDateTime value)
GenericRecord.cloneWithBuilder()
.
Otherwise, it is illegal to set to the same field twice.fieldName
- name of the field as it is defined in its class definition.
See ClassDefinition
for Portable
value
- to set to GenericRecordHazelcastSerializationException
- if the field name does not exist in the class definition or
the type of the field does not match the one in the class definition or
Same field is trying to be set without using
GenericRecord.cloneWithBuilder()
.@Nonnull GenericRecordBuilder setBooleanArray(@Nonnull String fieldName, @Nullable boolean[] value)
GenericRecord.cloneWithBuilder()
.
Otherwise, it is illegal to set to the same field twice.fieldName
- name of the field as it is defined in its class definition.
See ClassDefinition
for Portable
value
- to set to GenericRecordHazelcastSerializationException
- if the field name does not exist in the class definition or
the type of the field does not match the one in the class definition or
Same field is trying to be set without using
GenericRecord.cloneWithBuilder()
.@Nonnull GenericRecordBuilder setByteArray(@Nonnull String fieldName, @Nullable byte[] value)
GenericRecord.cloneWithBuilder()
.
Otherwise, it is illegal to set to the same field twice.fieldName
- name of the field as it is defined in its class definition.
See ClassDefinition
for Portable
value
- to set to GenericRecordHazelcastSerializationException
- if the field name does not exist in the class definition or
the type of the field does not match the one in the class definition or
Same field is trying to be set without using
GenericRecord.cloneWithBuilder()
.@Nonnull GenericRecordBuilder setCharArray(@Nonnull String fieldName, @Nullable char[] value)
GenericRecord.cloneWithBuilder()
.
Otherwise, it is illegal to set to the same field twice.fieldName
- name of the field as it is defined in its class definition.
See ClassDefinition
for Portable
value
- to set to GenericRecordHazelcastSerializationException
- if the field name does not exist in the class definition or
the type of the field does not match the one in the class definition or
Same field is trying to be set without using
GenericRecord.cloneWithBuilder()
.@Nonnull GenericRecordBuilder setFloatArray(@Nonnull String fieldName, @Nullable float[] value)
GenericRecord.cloneWithBuilder()
.
Otherwise, it is illegal to set to the same field twice.fieldName
- name of the field as it is defined in its class definition.
See ClassDefinition
for Portable
value
- to set to GenericRecordHazelcastSerializationException
- if the field name does not exist in the class definition or
the type of the field does not match the one in the class definition or
Same field is trying to be set without using
GenericRecord.cloneWithBuilder()
.@Nonnull GenericRecordBuilder setIntArray(@Nonnull String fieldName, @Nullable int[] value)
GenericRecord.cloneWithBuilder()
.
Otherwise, it is illegal to set to the same field twice.fieldName
- name of the field as it is defined in its class definition.
See ClassDefinition
for Portable
value
- to set to GenericRecordHazelcastSerializationException
- if the field name does not exist in the class definition or
the type of the field does not match the one in the class definition or
Same field is trying to be set without using
GenericRecord.cloneWithBuilder()
.@Nonnull GenericRecordBuilder setDoubleArray(@Nonnull String fieldName, @Nullable double[] value)
GenericRecord.cloneWithBuilder()
.
Otherwise, it is illegal to set to the same field twice.fieldName
- name of the field as it is defined in its class definition.
See ClassDefinition
for Portable
value
- to set to GenericRecordHazelcastSerializationException
- if the field name does not exist in the class definition or
the type of the field does not match the one in the class definition or
Same field is trying to be set without using
GenericRecord.cloneWithBuilder()
.@Nonnull GenericRecordBuilder setLongArray(@Nonnull String fieldName, @Nullable long[] value)
GenericRecord.cloneWithBuilder()
.
Otherwise, it is illegal to set to the same field twice.fieldName
- name of the field as it is defined in its class definition.
See ClassDefinition
for Portable
value
- to set to GenericRecordHazelcastSerializationException
- if the field name does not exist in the class definition or
the type of the field does not match the one in the class definition or
Same field is trying to be set without using
GenericRecord.cloneWithBuilder()
.@Nonnull GenericRecordBuilder setShortArray(@Nonnull String fieldName, @Nullable short[] value)
GenericRecord.cloneWithBuilder()
.
Otherwise, it is illegal to set to the same field twice.fieldName
- name of the field as it is defined in its class definition.
See ClassDefinition
for Portable
value
- to set to GenericRecordHazelcastSerializationException
- if the field name does not exist in the class definition or
the type of the field does not match the one in the class definition or
Same field is trying to be set without using
GenericRecord.cloneWithBuilder()
.@Nonnull GenericRecordBuilder setStringArray(@Nonnull String fieldName, @Nullable String[] value)
GenericRecord.cloneWithBuilder()
.
Otherwise, it is illegal to set to the same field twice.
Array items can not be null.fieldName
- name of the field as it is defined in its class definition.
See ClassDefinition
for Portable
value
- to set to GenericRecordHazelcastSerializationException
- if the field name does not exist in the class definition or
the type of the field does not match the one in the class definition or
Same field is trying to be set without using
GenericRecord.cloneWithBuilder()
.@Nonnull GenericRecordBuilder setDecimalArray(@Nonnull String fieldName, @Nullable BigDecimal[] value)
GenericRecord.cloneWithBuilder()
.
Otherwise, it is illegal to set to the same field twice.
Array items can not be null.fieldName
- name of the field as it is defined in its class definition.
See ClassDefinition
for Portable
value
- to set to GenericRecordHazelcastSerializationException
- if the field name does not exist in the class definition or
the type of the field does not match the one in the class definition or
Same field is trying to be set without using
GenericRecord.cloneWithBuilder()
.setDecimal(String, BigDecimal)
@Nonnull GenericRecordBuilder setTimeArray(@Nonnull String fieldName, @Nullable LocalTime[] value)
GenericRecord.cloneWithBuilder()
.
Otherwise, it is illegal to set to the same field twice.
Array items can not be null.fieldName
- name of the field as it is defined in its class definition.
See ClassDefinition
for Portable
value
- to set to GenericRecordHazelcastSerializationException
- if the field name does not exist in the class definition or
the type of the field does not match the one in the class definition or
Same field is trying to be set without using
GenericRecord.cloneWithBuilder()
.setTime(String, LocalTime)
@Nonnull GenericRecordBuilder setDateArray(@Nonnull String fieldName, @Nullable LocalDate[] value)
GenericRecord.cloneWithBuilder()
.
Otherwise, it is illegal to set to the same field twice.
Array items can not be null.fieldName
- name of the field as it is defined in its class definition.
See ClassDefinition
for Portable
value
- to set to GenericRecordHazelcastSerializationException
- if the field name does not exist in the class definition or
the type of the field does not match the one in the class definition or
Same field is trying to be set without using
GenericRecord.cloneWithBuilder()
.setDate(String, LocalDate)
@Nonnull GenericRecordBuilder setTimestampArray(@Nonnull String fieldName, @Nullable LocalDateTime[] value)
GenericRecord.cloneWithBuilder()
.
Otherwise, it is illegal to set to the same field twice.
Array items can not be null.fieldName
- name of the field as it is defined in its class definition.
See ClassDefinition
for Portable
value
- to set to GenericRecordHazelcastSerializationException
- if the field name does not exist in the class definition or
the type of the field does not match the one in the class definition or
Same field is trying to be set without using
GenericRecord.cloneWithBuilder()
.setTimestamp(String, LocalDateTime)
@Nonnull GenericRecordBuilder setTimestampWithTimezoneArray(@Nonnull String fieldName, @Nullable OffsetDateTime[] value)
GenericRecord.cloneWithBuilder()
.
Otherwise, it is illegal to set to the same field twice.
Array items can not be null.fieldName
- name of the field as it is defined in its class definition.
See ClassDefinition
for Portable
value
- to set to GenericRecordHazelcastSerializationException
- if the field name does not exist in the class definition or
the type of the field does not match the one in the class definition or
Same field is trying to be set without using
GenericRecord.cloneWithBuilder()
.setTimestampWithTimezone(String, OffsetDateTime)
@Nonnull GenericRecordBuilder setGenericRecordArray(@Nonnull String fieldName, @Nullable GenericRecord[] value)
GenericRecord.cloneWithBuilder()
.
Otherwise, it is illegal to set to the same field twice.
This method allows nested structures. Subclasses should also created as `GenericRecord`.
Array items can not be null.
fieldName
- name of the field as it is defined in its class definition.
See ClassDefinition
for Portable
value
- to set to GenericRecordHazelcastSerializationException
- if the field name does not exist in the class definition or
the type of the field does not match the one in the class definition or
Same field is trying to be set without using
GenericRecord.cloneWithBuilder()
.Copyright © 2023 Hazelcast, Inc.. All rights reserved.