core/src/main/java/com/orientechnologies/orient/core/serialization/serializer/binary/impl/index/OCompositeKeySerializer.java
@Override
  public void serializeInByteBufferObject(OCompositeKey object, ByteBuffer buffer, Object... hints) {
    final OType[] types = getKeyTypes(hints);

    final List<Object> keys = object.getKeys();
    final int keysSize = keys.size();

    final int oldStartOffset = buffer.position();
    buffer.position(oldStartOffset + OIntegerSerializer.INT_SIZE);

    buffer.putInt(keysSize);
    final OBinarySerializerFactory factory = OBinarySerializerFactory.getInstance();

    for (int i = 0; i < keys.size(); i++) {
      final Object key = keys.get(i);

      OBinarySerializer<Object> binarySerializer;
      if (key != null) {
        final OType type;
        if (types.length > i)
          type = types[i];
        else
          type = OType.getTypeByClass(key.getClass());

        binarySerializer = factory.getObjectSerializer(type);
      } else
        binarySerializer = ONullSerializer.INSTANCE;

      buffer.put(binarySerializer.getId());
      binarySerializer.serializeInByteBufferObject(key, buffer);
    }

    final int finalPosition = buffer.position();
    final int serializedSize = buffer.position() - oldStartOffset;

    buffer.position(oldStartOffset);
    buffer.putInt(serializedSize);

    buffer.position(finalPosition);
  }
@Override
  public void serializeInByteBufferObject(OCompositeKey object, ByteBuffer buffer, Object... hints) {
    final OType[] types = getKeyTypes(hints);

    final List<Object> keys = object.getKeys();
    final int keysSize = keys.size();

    final int oldStartOffset = buffer.position();
    buffer.position(oldStartOffset + OIntegerSerializer.INT_SIZE);

    buffer.putInt(keysSize);
    final OBinarySerializerFactory factory = OBinarySerializerFactory.getInstance();

    for (int i = 0; i < keys.size(); i++) {
      final Object key = keys.get(i);

      OBinarySerializer<Object> binarySerializer;
      if (key != null) {
        final OType type;
        if (types.length > i)
          type = types[i];
        else
          type = OType.getTypeByClass(key.getClass());

        binarySerializer = factory.getObjectSerializer(type);
      } else
        binarySerializer = ONullSerializer.INSTANCE;

      buffer.put(binarySerializer.getId());
      binarySerializer.serializeInByteBufferObject(key, buffer);
    }

    final int finalPosition = buffer.position();
    final int serializedSize = buffer.position() - oldStartOffset;

    buffer.position(oldStartOffset);
    buffer.putInt(serializedSize);

    buffer.position(finalPosition);
  }
@ Override public void serializeInByteBufferObject ( OCompositeKey object , ByteBuffer buffer , Object ... hints ) { final OType [ ] types = getKeyTypes ( hints ) ; final List < Object > keys = object . getKeys ( ) ; final int keysSize = keys . size ( ) ; final int oldStartOffset = buffer . position ( ) ; buffer . position ( oldStartOffset + OIntegerSerializer . INT_SIZE ) ; buffer . putInt ( keysSize ) ; final OBinarySerializerFactory factory = OBinarySerializerFactory . getInstance ( ) ; for ( int i = 0 ; i < keys . size ( ) ; i ++ ) { final Object key = keys . get ( i ) ; OBinarySerializer < Object > binarySerializer ; if ( key != null ) { final OType type ; if ( types . length > i ) type = types [ i ] ; else type = OType . getTypeByClass ( key . getClass ( ) ) ; binarySerializer = factory . getObjectSerializer ( type ) ; } else binarySerializer = ONullSerializer . INSTANCE ; buffer . put ( binarySerializer . getId ( ) ) ; binarySerializer . serializeInByteBufferObject ( key , buffer ) ; } final int finalPosition = buffer . position ( ) ; final int serializedSize = buffer . position ( ) - oldStartOffset ; buffer . position ( oldStartOffset ) ; buffer . putInt ( serializedSize ) ; buffer . position ( finalPosition ) ; }
{@inheritDoc}
{