aboutsummaryrefslogtreecommitdiffstats
path: root/document/src/main/java/com/yahoo/document/serialization/DocumentSerializerFactory.java
blob: 7ff58855c34a6b25df918104435f5d82b0f1a9b1 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.document.serialization;

import com.yahoo.io.GrowableByteBuffer;

/**
 * Factory for creating document serializers tied to a document format.
 *
 * @author geirst
 */
public class DocumentSerializerFactory {

    /**
     * Creates a serializer for the current head document format.
     * This format is an extension of the 4.2 format.
     */
    public static DocumentSerializer createHead(GrowableByteBuffer buf) {
        return new VespaDocumentSerializerHead(buf);
    }

    /**
     * Creates a serializer for the document format that was created on Vespa 4.2.
     */
    @SuppressWarnings("deprecation")
    public static DocumentSerializer create42(GrowableByteBuffer buf) {
        return new VespaDocumentSerializer42(buf);
    }

    /**
     * Creates a serializer for the document format that was created on Vespa 4.2.
     */
    @SuppressWarnings("deprecation")
    public static DocumentSerializer create42(GrowableByteBuffer buf, boolean headerOnly) {
        return new VespaDocumentSerializer42(buf, headerOnly);
    }

    /**
     * Creates a serializer for the document format that was created on Vespa 4.2.
     */
    @SuppressWarnings("deprecation")
    public static DocumentSerializer create42() {
        return new VespaDocumentSerializer42();
    }

}