aboutsummaryrefslogtreecommitdiffstats
path: root/document/src/main/java/com/yahoo/document/fieldset/BodyFields.java
blob: 72c48684b862aed69a63fcba2cef5274790a90a0 (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
// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.document.fieldset;

import com.yahoo.document.Field;

/**
 * Created with IntelliJ IDEA.
 * User: thomasg
 * Date: 4/25/12
 * Time: 3:18 PM
 * To change this template use File | Settings | File Templates.
 */
//TODO Vespa 7 Remove
@Deprecated
public class BodyFields implements FieldSet {
    @Override
    public boolean contains(FieldSet o) {
        if (o instanceof BodyFields || o instanceof DocIdOnly || o instanceof NoFields) {
            return true;
        }

        if (o instanceof Field) {
            return !((Field) o).isHeader();
        }

        if (o instanceof FieldCollection) {
            FieldCollection c = (FieldCollection)o;
            for (Field f : c) {
                if (f.isHeader()) {
                    return false;
                }
            }

            return true;
        } else {
            return false;
        }
    }

    @Override
    public FieldSet clone() throws CloneNotSupportedException {
        return new BodyFields();
    }
}