public static void encodeValue( PropertyBlock block, int keyId, Value value, DynamicRecordAllocator stringAllocator, DynamicRecordAllocator arrayAllocator, boolean allowStorePointsAndTemporal ) { if ( value instanceof ArrayValue ) { Object asObject = value.asObject(); // Try short array first, i.e. inlined in the property block if ( ShortArray.encode( keyId, asObject, block, PropertyType.getPayloadSize() ) ) { return; } // Fall back to dynamic array store List<DynamicRecord> arrayRecords = new ArrayList<>(); allocateArrayRecords( arrayRecords, asObject, arrayAllocator, allowStorePointsAndTemporal ); setSingleBlockValue( block, keyId, PropertyType.ARRAY, Iterables.first( arrayRecords ).getId() ); for ( DynamicRecord valueRecord : arrayRecords ) { valueRecord.setType( PropertyType.ARRAY.intValue() ); } block.setValueRecords( arrayRecords ); } else { value.writeTo( new PropertyBlockValueWriter( block, keyId, stringAllocator, allowStorePointsAndTemporal ) ); } }
public static void encodeValue( PropertyBlock block, int keyId, Value value, DynamicRecordAllocator stringAllocator, DynamicRecordAllocator arrayAllocator, boolean allowStorePointsAndTemporal ) { if ( value instanceof ArrayValue ) { Object asObject = value.asObject(); // Try short array first, i.e. inlined in the property block if ( ShortArray.encode( keyId, asObject, block, PropertyType.getPayloadSize() ) ) { return; } // Fall back to dynamic array store List<DynamicRecord> arrayRecords = new ArrayList<>(); allocateArrayRecords( arrayRecords, asObject, arrayAllocator, allowStorePointsAndTemporal ); setSingleBlockValue( block, keyId, PropertyType.ARRAY, Iterables.first( arrayRecords ).getId() ); for ( DynamicRecord valueRecord : arrayRecords ) { valueRecord.setType( PropertyType.ARRAY.intValue() ); } block.setValueRecords( arrayRecords ); } else { value.writeTo( new PropertyBlockValueWriter( block, keyId, stringAllocator, allowStorePointsAndTemporal ) ); } }