aboutsummaryrefslogtreecommitdiffstats
path: root/document/src/main/java/com/yahoo/document/serialization/FieldReader.java
blob: b7de4d26f88335414198a532506c32d3909e2630 (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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
// Copyright Vespa.ai. 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.Document;
import com.yahoo.document.annotation.AnnotationReference;
import com.yahoo.document.datatypes.Array;
import com.yahoo.document.datatypes.BoolFieldValue;
import com.yahoo.document.datatypes.ByteFieldValue;
import com.yahoo.document.datatypes.CollectionFieldValue;
import com.yahoo.document.datatypes.DoubleFieldValue;
import com.yahoo.document.datatypes.FieldValue;
import com.yahoo.document.datatypes.FloatFieldValue;
import com.yahoo.document.datatypes.IntegerFieldValue;
import com.yahoo.document.datatypes.LongFieldValue;
import com.yahoo.document.datatypes.MapFieldValue;
import com.yahoo.document.datatypes.PredicateFieldValue;
import com.yahoo.document.datatypes.Raw;
import com.yahoo.document.datatypes.ReferenceFieldValue;
import com.yahoo.document.datatypes.StringFieldValue;
import com.yahoo.document.datatypes.Struct;
import com.yahoo.document.datatypes.StructuredFieldValue;
import com.yahoo.document.datatypes.TensorFieldValue;
import com.yahoo.document.datatypes.WeightedSet;
import com.yahoo.vespa.objects.Deserializer;
import com.yahoo.vespa.objects.FieldBase;


/**
 * @author <a href="mailto:ravishar@yahoo-inc.com">ravishar</a>
 *
 */
public interface FieldReader extends Deserializer {

    /**
     * Read in the value of field
     *
     * @param field - field description (name and data type)
     * @param value - field value
     */
    void read(FieldBase field, Document value);
    /**
     * Read in the value of field
     *
     * @param field - field description (name and data type)
     * @param value - field value
     */
    void read(FieldBase field, FieldValue value);

    /**
     * Read in the value of array field
     *
     * @param field - field description (name and data type)
     * @param value - field value
     */
    <T extends FieldValue> void read(FieldBase field, Array<T> value);

    /**
     * Read the value of a map field
     */
    <K extends FieldValue, V extends FieldValue> void read(FieldBase field, MapFieldValue<K, V> map);

    /**
     * Read in the value of byte field
     *
     * @param field - field description (name and data type)
     * @param value - field value
     */
    void read(FieldBase field, ByteFieldValue value);

    /**
     * Read in the value of byte field
     *
     * @param field - field description (name and data type)
     * @param value - field value
     */
    void read(FieldBase field, BoolFieldValue value);

    /**
     * Read in the value of collection field
     *
     * @param field - field description (name and data type)
     * @param value - field value
     */
    <T extends FieldValue> void read(FieldBase field, CollectionFieldValue<T> value);

    /**
     * Read in the value of double field
     *
     * @param field - field description (name and data type)
     * @param value - field value
     */
    void read(FieldBase field, DoubleFieldValue value);

    /**
     * Read in the value of float field
     *
     * @param field - field description (name and data type)
     * @param value - field value
     */
    void read(FieldBase field, FloatFieldValue value);

    /**
     * Read in the value of integer field
     *
     * @param field - field description (name and data type)
     * @param value - field value
     */
    void read(FieldBase field, IntegerFieldValue value);

    /**
     * Read in the value of long field
     *
     * @param field - field description (name and data type)
     * @param value - field value
     */
    void read(FieldBase field, LongFieldValue value);

    /**
     * Read in the value of raw field
     *
     * @param field - field description (name and data type)
     * @param value - field value
     */
    void read(FieldBase field, Raw value);

    /**
     * Read in the value of predicate field
     *
     * @param field - field description (name and data type)
     * @param value - field value
     */
    void read(FieldBase field, PredicateFieldValue value);

    /**
     * Read in the value of string field
     *
     * @param field - field description (name and data type)
     * @param value - field value
     */
    void read(FieldBase field, StringFieldValue value);

    /**
     * Read in the value of the given tensor field.
     *
     * @param field field description (name and data type)
     * @param value tensor field value
     */
    void read(FieldBase field, TensorFieldValue value);

    /**
     * Read in the value of the given reference field.
     *
     * @param field field description (name and data type)
     * @param value reference field value
     */
    void read(FieldBase field, ReferenceFieldValue value);

    /**
     * Read in the value of struct field
     *
     * @param field - field description (name and data type)
     * @param value - field value
     */
    void read(FieldBase field, Struct value);

    /**
     * Read in the value of structured field
     *
     * @param field - field description (name and data type)
     * @param value - field value
     */
    void read(FieldBase field, StructuredFieldValue value);


    /**
     * Read in the value of weighted set field
     *
     * @param field - field description (name and data type)
     * @param value - field value
     */
    <T extends FieldValue> void read(FieldBase field, WeightedSet<T> value);

    /**
     * Read in the value of annotation reference.
     *
     * @param field - field description (name and data type)
     * @param value - field value
     */
    void read(FieldBase field, AnnotationReference value);

}