@Override
    protected void writeValue(final VertexProperty value, final Buffer buffer, final GraphBinaryWriter context) throws IOException {
        context.write(value.id(), buffer);
        // wrapping label into list here for now according to GraphBinaryV4, but we aren't allowing null label yet
        if (value.label() == null) {
            throw new IOException("Unexpected null value when nullable is false");
        }
        context.writeValue(Collections.singletonList(value.label()), buffer, false);
        context.write(value.value(), buffer);

        // we don't serialize the parent vertex, let's hold a place for it
        context.write(null, buffer);

        if (value instanceof ReferenceVertexProperty) {
            context.write(null, buffer);
        }
        else {
            final List<?> asList = value.graph().features().vertex().supportsMetaProperties() ?
                    IteratorUtils.toList(value.properties()) :
                    Collections.emptyList();
            context.write(asList, buffer);
        }
    }
@author Stephen Mallette (http://stephen.genoprime.com)
gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/binary/types/VertexPropertySerializer.java