Search in sources :

Example 11 with FieldKind

use of com.hazelcast.nio.serialization.FieldKind in project hazelcast by hazelcast.

the class CompactInternalGenericRecord method getInt16.

@Override
public short getInt16(@Nonnull String fieldName) {
    FieldDescriptor fd = getFieldDefinition(fieldName);
    FieldKind fieldKind = fd.getKind();
    switch(fieldKind) {
        case INT16:
            try {
                return in.readShort(readFixedSizePosition(fd));
            } catch (IOException e) {
                throw illegalStateException(e);
            }
        case NULLABLE_INT16:
            return getVariableSizeAsNonNull(fd, ObjectDataInput::readShort, "Int16");
        default:
            throw unexpectedFieldKind(fieldKind, fieldName);
    }
}
Also used : FieldKind(com.hazelcast.nio.serialization.FieldKind) IOException(java.io.IOException) BufferObjectDataInput(com.hazelcast.internal.nio.BufferObjectDataInput) ObjectDataInput(com.hazelcast.nio.ObjectDataInput)

Example 12 with FieldKind

use of com.hazelcast.nio.serialization.FieldKind in project hazelcast by hazelcast.

the class CompactInternalGenericRecord method getNullableInt8.

@Nullable
@Override
public Byte getNullableInt8(@Nonnull String fieldName) {
    FieldDescriptor fd = getFieldDefinition(fieldName);
    FieldKind fieldKind = fd.getKind();
    switch(fieldKind) {
        case INT8:
            try {
                return in.readByte(readFixedSizePosition(fd));
            } catch (IOException e) {
                throw illegalStateException(e);
            }
        case NULLABLE_INT8:
            return getVariableSize(fd, ObjectDataInput::readByte);
        default:
            throw unexpectedFieldKind(fieldKind, fieldName);
    }
}
Also used : FieldKind(com.hazelcast.nio.serialization.FieldKind) IOException(java.io.IOException) BufferObjectDataInput(com.hazelcast.internal.nio.BufferObjectDataInput) ObjectDataInput(com.hazelcast.nio.ObjectDataInput) Nullable(javax.annotation.Nullable)

Example 13 with FieldKind

use of com.hazelcast.nio.serialization.FieldKind in project hazelcast by hazelcast.

the class CompactInternalGenericRecord method getNullableFloat32.

@Nullable
@Override
public Float getNullableFloat32(@Nonnull String fieldName) {
    FieldDescriptor fd = getFieldDefinition(fieldName);
    FieldKind fieldKind = fd.getKind();
    switch(fieldKind) {
        case FLOAT32:
            try {
                return in.readFloat(readFixedSizePosition(fd));
            } catch (IOException e) {
                throw illegalStateException(e);
            }
        case NULLABLE_FLOAT32:
            return getVariableSize(fd, ObjectDataInput::readFloat);
        default:
            throw unexpectedFieldKind(fieldKind, fieldName);
    }
}
Also used : FieldKind(com.hazelcast.nio.serialization.FieldKind) IOException(java.io.IOException) BufferObjectDataInput(com.hazelcast.internal.nio.BufferObjectDataInput) ObjectDataInput(com.hazelcast.nio.ObjectDataInput) Nullable(javax.annotation.Nullable)

Example 14 with FieldKind

use of com.hazelcast.nio.serialization.FieldKind in project hazelcast by hazelcast.

the class CompactInternalGenericRecord method getNullableBoolean.

@Nullable
@Override
public Boolean getNullableBoolean(@Nonnull String fieldName) {
    FieldDescriptor fd = getFieldDefinition(fieldName);
    FieldKind fieldKind = fd.getKind();
    switch(fieldKind) {
        case BOOLEAN:
            return getBoolean(fd);
        case NULLABLE_BOOLEAN:
            return getVariableSize(fd, ObjectDataInput::readBoolean);
        default:
            throw unexpectedFieldKind(fieldKind, fieldName);
    }
}
Also used : FieldKind(com.hazelcast.nio.serialization.FieldKind) BufferObjectDataInput(com.hazelcast.internal.nio.BufferObjectDataInput) ObjectDataInput(com.hazelcast.nio.ObjectDataInput) Nullable(javax.annotation.Nullable)

Example 15 with FieldKind

use of com.hazelcast.nio.serialization.FieldKind in project hazelcast by hazelcast.

the class CompactInternalGenericRecord method getFloat64.

@Override
public double getFloat64(@Nonnull String fieldName) {
    FieldDescriptor fd = getFieldDefinition(fieldName);
    FieldKind fieldKind = fd.getKind();
    switch(fieldKind) {
        case FLOAT64:
            try {
                return in.readDouble(readFixedSizePosition(fd));
            } catch (IOException e) {
                throw illegalStateException(e);
            }
        case NULLABLE_FLOAT64:
            return getVariableSizeAsNonNull(fd, ObjectDataInput::readDouble, "Float64");
        default:
            throw unexpectedFieldKind(fieldKind, fieldName);
    }
}
Also used : FieldKind(com.hazelcast.nio.serialization.FieldKind) IOException(java.io.IOException) BufferObjectDataInput(com.hazelcast.internal.nio.BufferObjectDataInput) ObjectDataInput(com.hazelcast.nio.ObjectDataInput)

Aggregations

FieldKind (com.hazelcast.nio.serialization.FieldKind)40 Nullable (javax.annotation.Nullable)24 BufferObjectDataInput (com.hazelcast.internal.nio.BufferObjectDataInput)17 ObjectDataInput (com.hazelcast.nio.ObjectDataInput)16 IOException (java.io.IOException)14 Nonnull (javax.annotation.Nonnull)3 HazelcastSerializationException (com.hazelcast.nio.serialization.HazelcastSerializationException)2 QueryDataType (com.hazelcast.sql.impl.type.QueryDataType)2 DeserializedSchemaBoundGenericRecordBuilder (com.hazelcast.internal.serialization.impl.compact.DeserializedSchemaBoundGenericRecordBuilder)1 Schema (com.hazelcast.internal.serialization.impl.compact.Schema)1 FieldTypeToFieldKind (com.hazelcast.internal.serialization.impl.portable.FieldTypeToFieldKind)1 FAILING_TOP_LEVEL_INJECTOR (com.hazelcast.jet.sql.impl.inject.UpsertInjector.FAILING_TOP_LEVEL_INJECTOR)1 GenericRecord (com.hazelcast.nio.serialization.GenericRecord)1 GenericRecordBuilder (com.hazelcast.nio.serialization.GenericRecordBuilder)1 QueryException (com.hazelcast.sql.impl.QueryException)1 BigDecimal (java.math.BigDecimal)1 LocalDate (java.time.LocalDate)1 LocalDateTime (java.time.LocalDateTime)1 LocalTime (java.time.LocalTime)1 OffsetDateTime (java.time.OffsetDateTime)1