Search in sources :

Example 26 with FieldKind

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

the class DeserializedGenericRecord method getArrayOfNullableFloat64.

@Nullable
@Override
public Double[] getArrayOfNullableFloat64(@Nonnull String fieldName) {
    FieldKind fieldKind = check(fieldName, ARRAY_OF_FLOAT64, ARRAY_OF_NULLABLE_FLOAT64);
    if (fieldKind == ARRAY_OF_FLOAT64) {
        double[] array = (double[]) objects.get(fieldName);
        Double[] result = new Double[array.length];
        Arrays.setAll(result, i -> array[i]);
        return result;
    }
    return (Double[]) objects.get(fieldName);
}
Also used : FieldKind(com.hazelcast.nio.serialization.FieldKind) Nullable(javax.annotation.Nullable)

Example 27 with FieldKind

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

the class DeserializedGenericRecord method getArrayOfNullableInt8.

@Nullable
@Override
public Byte[] getArrayOfNullableInt8(@Nonnull String fieldName) {
    FieldKind fieldKind = check(fieldName, ARRAY_OF_INT8, ARRAY_OF_NULLABLE_INT8);
    if (fieldKind == ARRAY_OF_INT8) {
        byte[] array = (byte[]) objects.get(fieldName);
        Byte[] result = new Byte[array.length];
        Arrays.setAll(result, i -> array[i]);
        return result;
    }
    return (Byte[]) objects.get(fieldName);
}
Also used : FieldKind(com.hazelcast.nio.serialization.FieldKind) Nullable(javax.annotation.Nullable)

Example 28 with FieldKind

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

the class DeserializedGenericRecord method getArrayOfFloat32.

@Override
@Nullable
public float[] getArrayOfFloat32(@Nonnull String fieldName) {
    FieldKind fieldKind = check(fieldName, ARRAY_OF_FLOAT32, ARRAY_OF_NULLABLE_FLOAT32);
    if (fieldKind == ARRAY_OF_NULLABLE_FLOAT32) {
        Float[] array = (Float[]) objects.get(fieldName);
        float[] result = new float[array.length];
        for (int i = 0; i < array.length; i++) {
            if (array[i] == null) {
                throw exceptionForUnexpectedNullValueInArray(fieldName, "Float32");
            }
            result[i] = array[i];
        }
        return result;
    }
    return (float[]) objects.get(fieldName);
}
Also used : FieldKind(com.hazelcast.nio.serialization.FieldKind) Nullable(javax.annotation.Nullable)

Example 29 with FieldKind

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

the class DeserializedGenericRecord method getArrayOfNullableBoolean.

@Nullable
@Override
public Boolean[] getArrayOfNullableBoolean(@Nonnull String fieldName) {
    FieldKind fieldKind = check(fieldName, ARRAY_OF_BOOLEAN, ARRAY_OF_NULLABLE_BOOLEAN);
    if (fieldKind == ARRAY_OF_BOOLEAN) {
        boolean[] array = (boolean[]) objects.get(fieldName);
        Boolean[] result = new Boolean[array.length];
        Arrays.setAll(result, i -> array[i]);
        return result;
    }
    return (Boolean[]) objects.get(fieldName);
}
Also used : FieldKind(com.hazelcast.nio.serialization.FieldKind) Nullable(javax.annotation.Nullable)

Example 30 with FieldKind

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

the class DeserializedGenericRecord method getArrayOfNullableInt16.

@Nullable
@Override
public Short[] getArrayOfNullableInt16(@Nonnull String fieldName) {
    FieldKind fieldKind = check(fieldName, ARRAY_OF_INT16, ARRAY_OF_NULLABLE_INT16);
    if (fieldKind == ARRAY_OF_INT16) {
        short[] array = (short[]) objects.get(fieldName);
        Short[] result = new Short[array.length];
        Arrays.setAll(result, i -> array[i]);
        return result;
    }
    return (Short[]) objects.get(fieldName);
}
Also used : FieldKind(com.hazelcast.nio.serialization.FieldKind) Nullable(javax.annotation.Nullable)

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