compatibility

package
v1.4.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 22, 2023 License: Apache-2.0 Imports: 11 Imported by: 0

README

The serialization binary compatibility file is autogenerated using the following file from the Hazelcast repository.

https://github.com/hazelcast/hazelcast/blob/master/hazelcast/src/test/java/com/hazelcast/nio/serialization/compatibility/BinaryCompatibilityFileGenerator.java

ReferenceObjects.java

package com.hazelcast.nio.serialization.compatibility;
import static java.util.Arrays.asList;
import com.hazelcast.aggregation.Aggregators;
import com.hazelcast.core.EntryEventType;
import com.hazelcast.internal.serialization.Data;
import com.hazelcast.internal.serialization.impl.HeapData;
import com.hazelcast.nio.serialization.Portable;
import com.hazelcast.query.Predicates;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.LocalTime;
import java.time.OffsetDateTime;
import java.time.ZoneOffset;
import java.util.AbstractMap;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.Optional;
import java.util.UUID;
class ReferenceObjects {
    /**
     * PORTABLE IDS
     **/
    static int PORTABLE_FACTORY_ID = 1;
    static int PORTABLE_CLASS_ID = 1;
    static int INNER_PORTABLE_CLASS_ID = 2;
    /**
     * IDENTIFIED DATA SERIALIZABLE IDS
     **/
    static int IDENTIFIED_DATA_SERIALIZABLE_FACTORY_ID = 1;
    static int DATA_SERIALIZABLE_CLASS_ID = 1;
    /**
     * CUSTOM SERIALIZER IDS
     */
    static int CUSTOM_STREAM_SERIALIZABLE_ID = 1;
    static int CUSTOM_BYTE_ARRAY_SERIALIZABLE_ID = 2;
    /**
     * OBJECTS
     */
    static Object aNullObject = null;
    static boolean aBoolean = true;
    static byte aByte = 113;
    static char aChar = 'x';
    static double aDouble = -897543.3678909d;
    static short aShort = -500;
    static float aFloat = 900.5678f;
    static int anInt = 56789;
    static long aLong = -50992225L;
    static String anSqlString = "this > 5 AND this < 100";
    static String aString = anSqlString;
    static UUID aUUID = new UUID(aLong, anInt);
    static String aSmallString = "😊 Hello Приве́т नमस्ते שָׁלוֹם";
    static boolean[] booleans = {true, false, true};
    static byte[] bytes = {112, 4, 1, 4, 112, 35, 43};
    static char[] chars = {'a', 'b', 'c'};
    static double[] doubles = {-897543.3678909d, 11.1d, 22.2d, 33.3d};
    static short[] shorts = {-500, 2, 3};
    static float[] floats = {900.5678f, 1.0f, 2.1f, 3.4f};
    static int[] ints = {56789, 2, 3};
    static long[] longs = {-50992225L, 1231232141L, 2L, 3L};
    static String[] strings = {
            "Pijamalı hasta, yağız şoföre çabucak güvendi.",
            "イロハニホヘト チリヌルヲ ワカヨタレソ ツネナラム",
            "The quick brown fox jumps over the lazy dog",
    };
    static Data aData = new HeapData("111313123131313131".getBytes());
    static AnInnerPortable anInnerPortable = new AnInnerPortable(anInt, aFloat);
    static CustomStreamSerializable aCustomStreamSerializable = new CustomStreamSerializable(anInt, aFloat);
    static CustomByteArraySerializable aCustomByteArraySerializable = new CustomByteArraySerializable(anInt, aFloat);
    static Portable[] portables = {anInnerPortable, anInnerPortable, anInnerPortable};
    static AbstractMap.SimpleEntry aSimpleMapEntry = new AbstractMap.SimpleEntry(aSmallString, anInnerPortable);
    static AbstractMap.SimpleImmutableEntry aSimpleImmutableMapEntry = new AbstractMap.SimpleImmutableEntry(aSmallString,
            anInnerPortable);
    static AnIdentifiedDataSerializable anIdentifiedDataSerializable = new AnIdentifiedDataSerializable(
            aBoolean, aByte, aChar, aDouble, aShort, aFloat, anInt, aLong, anSqlString,
            booleans, bytes, chars, doubles, shorts, floats, ints, longs, strings,
            anInnerPortable, null,
            aCustomStreamSerializable,
            aCustomByteArraySerializable, aData);
    static Date aDate;
    static LocalDate aLocalDate;
    static LocalTime aLocalTime;
    static LocalDateTime aLocalDateTime;
    static OffsetDateTime aOffsetDateTime;
    static LocalDate[] localDates;
    static LocalTime[] localTimes;
    static LocalDateTime[] localDateTimes;
    static OffsetDateTime[] offsetDateTimes;
    static {
        Calendar calendar = Calendar.getInstance();
        calendar.set(1990, Calendar.FEBRUARY, 1, 0, 0, 0);
        calendar.set(Calendar.MILLISECOND, 0);
        calendar.set(Calendar.ZONE_OFFSET, 0);
        calendar.set(Calendar.DST_OFFSET, 0);
        aDate = calendar.getTime();
        aLocalDate = LocalDate.of(2021, 6, 28);
        aLocalTime = LocalTime.of(11, 22, 41, 123456789);
        aLocalDateTime = LocalDateTime.of(aLocalDate, aLocalTime);
        aOffsetDateTime = OffsetDateTime.of(aLocalDateTime, ZoneOffset.ofHours(18));
        localDates= new LocalDate[]{
                LocalDate.of(2021, 6, 28),
                LocalDate.of(1923, 4, 23),
                LocalDate.of(1938, 11, 10)};
        localTimes = new LocalTime[]{
                LocalTime.of(9, 5, 10, 123456789),
                LocalTime.of(18, 30, 55, 567891234),
                LocalTime.of(15, 44, 39, 192837465)};
        localDateTimes= new LocalDateTime[]{
                LocalDateTime.of(LocalDate.of(1938, 11, 10), LocalTime.of(9, 5, 10, 123456789)),
                LocalDateTime.of(LocalDate.of(1923, 4, 23), LocalTime.of(15, 44, 39, 192837465)),
                LocalDateTime.of(LocalDate.of(2021, 6, 28), LocalTime.of(18, 30, 55, 567891234))};
        offsetDateTimes= new OffsetDateTime[]{
                OffsetDateTime.of(LocalDate.of(1938, 11, 10), LocalTime.of(9, 5, 10, 123456789),
                        ZoneOffset.ofHours(18)),
                OffsetDateTime.of(LocalDateTime.of(LocalDate.of(1923, 4, 23), LocalTime.of(15, 44, 39, 192837465)),
                        ZoneOffset.ofHours(5)),
                OffsetDateTime.of(LocalDateTime.of(LocalDate.of(2021, 6, 28), LocalTime.of(18, 30, 55, 567891234)),
                        ZoneOffset.ofHours(-10))};
    }
    static BigInteger aBigInteger = new BigInteger("1314432323232411");
    static BigDecimal aBigDecimal = new BigDecimal(31231);
    static BigDecimal[] decimals = {aBigDecimal, aBigDecimal ,aBigDecimal};
    static APortable aPortable = new APortable(
            aBoolean, aByte, aChar, aDouble, aShort, aFloat, anInt, aLong, anSqlString, aBigDecimal,
            aLocalDate, aLocalTime, aLocalDateTime, aOffsetDateTime, anInnerPortable,
            booleans, bytes, chars, doubles, shorts, floats, ints, longs, strings, decimals,
            localDates, localTimes, localDateTimes, offsetDateTimes, portables,
            anIdentifiedDataSerializable,
            aCustomStreamSerializable,
            aCustomByteArraySerializable, aData);
    static Class aClass = BigDecimal.class;
    static Optional<String> aFullOptional = Optional.of("SERIALIZEDSTRING");
    static Optional<String> anEmptyOptional = Optional.empty();
    static Enum anEnum = EntryEventType.ADDED;
    static ArrayList nonNullList = new ArrayList(asList(
            aBoolean, aByte, aChar, aDouble, aShort, aFloat, anInt, aLong, aSmallString, anInnerPortable,
            booleans, bytes, chars, doubles, shorts, floats, ints, longs, strings,
            aCustomStreamSerializable, aCustomByteArraySerializable,
            anIdentifiedDataSerializable, aPortable,
            aDate, aLocalDate, aLocalTime, aLocalDateTime, aOffsetDateTime, aBigInteger, aBigDecimal, aClass,
            anEmptyOptional, aFullOptional, anEnum, aSimpleMapEntry, aSimpleImmutableMapEntry
            ));
    static Object[] allTestObjects = {
            aNullObject, aBoolean, aByte, aChar, aDouble, aShort, aFloat, anInt, aLong, aString, aUUID, anInnerPortable,
            aSimpleMapEntry, aSimpleImmutableMapEntry, booleans, bytes, chars, doubles, shorts, floats, ints, longs, strings,
            aCustomStreamSerializable, aCustomByteArraySerializable,
            anIdentifiedDataSerializable, aPortable,
            aDate, aLocalDate, aLocalTime, aLocalDateTime, aOffsetDateTime, aBigInteger, aBigDecimal, aClass,
            aFullOptional, anEnum,
            // predicates
            Predicates.alwaysTrue(),
            Predicates.alwaysFalse(),
            Predicates.sql(anSqlString),
            Predicates.equal(anSqlString, anInt),
            Predicates.notEqual(anSqlString, anInt),
            Predicates.greaterThan(anSqlString, anInt),
            Predicates.between(anSqlString, anInt, anInt),
            Predicates.like(anSqlString, anSqlString),
            Predicates.ilike(anSqlString, anSqlString),
            Predicates.in(anSqlString, anInt, anInt),
            Predicates.regex(anSqlString, anSqlString),
            Predicates.and(Predicates.sql(anSqlString),
                    Predicates.equal(anSqlString, anInt),
                    Predicates.notEqual(anSqlString, anInt),
                    Predicates.greaterThan(anSqlString, anInt),
                    Predicates.greaterEqual(anSqlString, anInt)),
            Predicates.or(Predicates.sql(anSqlString),
                    Predicates.equal(anSqlString, anInt),
                    Predicates.notEqual(anSqlString, anInt),
                    Predicates.greaterThan(anSqlString, anInt),
                    Predicates.greaterEqual(anSqlString, anInt)),
            Predicates.instanceOf(aCustomStreamSerializable.getClass()),
            // Aggregators
            Aggregators.count(anSqlString),
            Aggregators.distinct(anSqlString),
            Aggregators.maxBy(anSqlString),
            Aggregators.minBy(anSqlString),
            Aggregators.comparableMax(anSqlString),
            Aggregators.comparableMin(anSqlString),
            Aggregators.doubleSum(anSqlString),
            Aggregators.integerSum(anSqlString),
            Aggregators.longSum(anSqlString),
            Aggregators.doubleAvg(anSqlString),
            Aggregators.integerAvg(anSqlString),
            Aggregators.longAvg(anSqlString),
    };
}

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type APortable

type APortable struct {
	// contains filtered or unexported fields
}

func (APortable) ClassID

func (p APortable) ClassID() int32

func (APortable) FactoryID

func (p APortable) FactoryID() int32

func (*APortable) ReadPortable

func (p *APortable) ReadPortable(reader serialization.PortableReader)

func (APortable) WritePortable

func (p APortable) WritePortable(writer serialization.PortableWriter)

type AnIdentifiedDataSerializable

type AnIdentifiedDataSerializable struct {
	// contains filtered or unexported fields
}

func (AnIdentifiedDataSerializable) ClassID

func (i AnIdentifiedDataSerializable) ClassID() int32

func (AnIdentifiedDataSerializable) FactoryID

func (i AnIdentifiedDataSerializable) FactoryID() int32

func (*AnIdentifiedDataSerializable) ReadData

func (AnIdentifiedDataSerializable) WriteData

type AnInnerPortable

type AnInnerPortable struct {
	// contains filtered or unexported fields
}

func (AnInnerPortable) ClassID

func (p AnInnerPortable) ClassID() int32

func (AnInnerPortable) FactoryID

func (p AnInnerPortable) FactoryID() int32

func (*AnInnerPortable) ReadPortable

func (p *AnInnerPortable) ReadPortable(reader serialization.PortableReader)

func (AnInnerPortable) WritePortable

func (p AnInnerPortable) WritePortable(out serialization.PortableWriter)

type CustomByteArraySerializable

type CustomByteArraySerializable struct {
	I int32
	F float32
}

type CustomByteArraySerializer

type CustomByteArraySerializer struct{}

func (CustomByteArraySerializer) ID

func (e CustomByteArraySerializer) ID() (id int32)

func (CustomByteArraySerializer) Read

func (e CustomByteArraySerializer) Read(input serialization.DataInput) interface{}

func (CustomByteArraySerializer) Write

func (e CustomByteArraySerializer) Write(output serialization.DataOutput, object interface{})

type CustomStreamSerializable

type CustomStreamSerializable struct {
	I int32
	F float32
}

type CustomStreamSerializer

type CustomStreamSerializer struct{}

func (CustomStreamSerializer) ID

func (e CustomStreamSerializer) ID() (id int32)

func (CustomStreamSerializer) Read

func (e CustomStreamSerializer) Read(input serialization.DataInput) interface{}

func (CustomStreamSerializer) Write

func (e CustomStreamSerializer) Write(out serialization.DataOutput, object interface{})

type IdentifiedFactory

type IdentifiedFactory struct{}

func (IdentifiedFactory) Create

func (IdentifiedFactory) FactoryID

func (f IdentifiedFactory) FactoryID() int32

type PortableFactory

type PortableFactory struct{}

func (PortableFactory) Create

func (p PortableFactory) Create(classID int32) serialization.Portable

func (PortableFactory) FactoryID

func (p PortableFactory) FactoryID() int32

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL