aboutsummaryrefslogtreecommitdiffstats
path: root/document/src/main/java/com/yahoo/document/serialization/DocumentDeserializerFactory.java
blob: 072f11f5f22fec7d7d8c9b0ae957cfc9df112bdc (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
// 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.document.DocumentTypeManager;
import com.yahoo.io.GrowableByteBuffer;

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

    /**
     * Creates a de-serializer for the current head document format.
     * This format is an extension of the 4.2 format.
     */
    public static DocumentDeserializer createHead(DocumentTypeManager manager, GrowableByteBuffer buf) {
        return new VespaDocumentDeserializerHead(manager, buf);
    }

    /**
     * Creates a de-serializer for the document format that was created on Vespa 4.2.
     */
    @SuppressWarnings("deprecation")
    public static DocumentDeserializer create42(DocumentTypeManager manager, GrowableByteBuffer buf) {
        return new VespaDocumentDeserializer42(manager, buf);
    }

    /**
     * Creates a de-serializer for the document format that was created on Vespa 4.2.
     */
    @SuppressWarnings("deprecation")
    public static DocumentDeserializer create42(DocumentTypeManager manager, GrowableByteBuffer buf, GrowableByteBuffer body) {
        return new VespaDocumentDeserializer42(manager, buf, body);
    }
}