use of example.serialization.InnerDTO in project hazelcast by hazelcast.
the class CompactTestUtil method createCompactGenericRecord.
@Nonnull
static GenericRecord createCompactGenericRecord(MainDTO mainDTO) {
InnerDTO inner = mainDTO.p;
GenericRecord[] namedRecords = new GenericRecord[inner.nn.length];
int i = 0;
for (NamedDTO named : inner.nn) {
GenericRecord namedRecord = GenericRecordBuilder.compact("named").setString("name", named.name).setInt32("myint", named.myint).build();
namedRecords[i++] = namedRecord;
}
GenericRecord innerRecord = GenericRecordBuilder.compact("inner").setArrayOfInt8("b", inner.bb).setArrayOfInt16("s", inner.ss).setArrayOfInt32("i", inner.ii).setArrayOfInt64("l", inner.ll).setArrayOfFloat32("f", inner.ff).setArrayOfFloat64("d", inner.dd).setArrayOfGenericRecord("nn", namedRecords).setArrayOfDecimal("bigDecimals", inner.bigDecimals).setArrayOfTime("localTimes", inner.localTimes).setArrayOfDate("localDates", inner.localDates).setArrayOfTimestamp("localDateTimes", inner.localDateTimes).setArrayOfTimestampWithTimezone("offsetDateTimes", inner.offsetDateTimes).build();
return GenericRecordBuilder.compact("main").setInt8("b", mainDTO.b).setBoolean("bool", mainDTO.bool).setInt16("s", mainDTO.s).setInt32("i", mainDTO.i).setInt64("l", mainDTO.l).setFloat32("f", mainDTO.f).setFloat64("d", mainDTO.d).setString("str", mainDTO.str).setDecimal("bigDecimal", mainDTO.bigDecimal).setGenericRecord("p", innerRecord).setTime("localTime", mainDTO.localTime).setDate("localDate", mainDTO.localDate).setTimestamp("localDateTime", mainDTO.localDateTime).setTimestampWithTimezone("offsetDateTime", mainDTO.offsetDateTime).setNullableInt8("nullable_b", mainDTO.b).setNullableBoolean("nullable_bool", mainDTO.bool).setNullableInt16("nullable_s", mainDTO.s).setNullableInt32("nullable_i", mainDTO.i).setNullableInt64("nullable_l", mainDTO.l).setNullableFloat32("nullable_f", mainDTO.f).setNullableFloat64("nullable_d", mainDTO.d).build();
}
use of example.serialization.InnerDTO in project hazelcast by hazelcast.
the class CompactTestUtil method createMainDTO.
@Nonnull
static MainDTO createMainDTO() {
NamedDTO[] nn = new NamedDTO[2];
nn[0] = new NamedDTO("name", 123);
nn[1] = new NamedDTO("name", 123);
InnerDTO inner = new InnerDTO(new boolean[] { true, false }, new byte[] { 0, 1, 2 }, new short[] { 3, 4, 5 }, new int[] { 9, 8, 7, 6 }, new long[] { 0, 1, 5, 7, 9, 11 }, new float[] { 0.6543f, -3.56f, 45.67f }, new double[] { 456.456, 789.789, 321.321 }, nn, new BigDecimal[] { new BigDecimal("12345"), new BigDecimal("123456") }, new LocalTime[] { LocalTime.now(), LocalTime.now() }, new LocalDate[] { LocalDate.now(), LocalDate.now() }, new LocalDateTime[] { LocalDateTime.now() }, new OffsetDateTime[] { OffsetDateTime.now() }, new Boolean[] { true, false, null }, new Byte[] { 0, 1, 2, null }, new Short[] { 3, 4, 5, null }, new Integer[] { 9, 8, 7, 6, null }, new Long[] { 0L, 1L, 5L, 7L, 9L, 11L }, new Float[] { 0.6543f, -3.56f, 45.67f }, new Double[] { 456.456, 789.789, 321.321 }, new LocalTime[] { LocalTime.now(), LocalTime.now() }, new LocalDate[] { LocalDate.now(), LocalDate.now(), null }, new LocalDateTime[] { LocalDateTime.now(), null }, new OffsetDateTime[] { OffsetDateTime.now() });
return new MainDTO((byte) 113, true, (short) -500, 56789, -50992225L, 900.5678f, -897543.3678909d, "this is main object created for testing!", inner, new BigDecimal("12312313"), LocalTime.now(), LocalDate.now(), LocalDateTime.now(), OffsetDateTime.now(), (byte) 113, true, (short) -500, 56789, -50992225L, 900.5678f, -897543.3678909d);
}
Aggregations