use of com.hazelcast.nio.serialization.FieldKind in project hazelcast by hazelcast.
the class DeserializedGenericRecord method getArrayOfBoolean.
@Override
@Nullable
public boolean[] getArrayOfBoolean(@Nonnull String fieldName) {
FieldKind fieldKind = check(fieldName, ARRAY_OF_BOOLEAN, ARRAY_OF_NULLABLE_BOOLEAN);
if (fieldKind == ARRAY_OF_NULLABLE_BOOLEAN) {
Boolean[] array = (Boolean[]) objects.get(fieldName);
boolean[] result = new boolean[array.length];
for (int i = 0; i < array.length; i++) {
if (array[i] == null) {
throw exceptionForUnexpectedNullValueInArray(fieldName, "Boolean");
}
result[i] = array[i];
}
return result;
}
return (boolean[]) objects.get(fieldName);
}
use of com.hazelcast.nio.serialization.FieldKind in project hazelcast by hazelcast.
the class DeserializedGenericRecord method getArrayOfNullableFloat32.
@Nullable
@Override
public Float[] getArrayOfNullableFloat32(@Nonnull String fieldName) {
FieldKind fieldKind = check(fieldName, ARRAY_OF_FLOAT32, ARRAY_OF_NULLABLE_FLOAT32);
if (fieldKind == ARRAY_OF_FLOAT32) {
float[] array = (float[]) objects.get(fieldName);
Float[] result = new Float[array.length];
Arrays.setAll(result, i -> array[i]);
return result;
}
return (Float[]) objects.get(fieldName);
}
use of com.hazelcast.nio.serialization.FieldKind in project hazelcast by hazelcast.
the class DeserializedGenericRecord method getArrayOfInt8.
@Override
@Nullable
public byte[] getArrayOfInt8(@Nonnull String fieldName) {
FieldKind fieldKind = check(fieldName, ARRAY_OF_INT8, ARRAY_OF_NULLABLE_INT8);
if (fieldKind == ARRAY_OF_NULLABLE_INT8) {
Byte[] array = (Byte[]) objects.get(fieldName);
byte[] result = new byte[array.length];
for (int i = 0; i < array.length; i++) {
if (array[i] == null) {
throw exceptionForUnexpectedNullValueInArray(fieldName, "Int8");
}
result[i] = array[i];
}
return result;
}
return (byte[]) objects.get(fieldName);
}
use of com.hazelcast.nio.serialization.FieldKind in project hazelcast by hazelcast.
the class CompactInternalGenericRecord method getArrayOfBoolean.
@Override
@Nullable
public boolean[] getArrayOfBoolean(@Nonnull String fieldName) {
FieldDescriptor fd = getFieldDefinition(fieldName);
FieldKind fieldKind = fd.getKind();
switch(fieldKind) {
case ARRAY_OF_BOOLEAN:
return getVariableSize(fd, CompactInternalGenericRecord::readBooleanBits);
case ARRAY_OF_NULLABLE_BOOLEAN:
return getNullableArrayAsPrimitiveArray(fd, ObjectDataInput::readBooleanArray, "Boolean");
default:
throw unexpectedFieldKind(fieldKind, fieldName);
}
}
use of com.hazelcast.nio.serialization.FieldKind in project hazelcast by hazelcast.
the class CompactInternalGenericRecord method getNullableFloat64.
@Nullable
@Override
public Double getNullableFloat64(@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 getVariableSize(fd, ObjectDataInput::readDouble);
default:
throw unexpectedFieldKind(fieldKind, fieldName);
}
}
Aggregations