summaryrefslogtreecommitdiffstats
path: root/config-model/src/main/java/com/yahoo/schema/FieldOperationApplier.java
blob: b2f40b045ea1a0d2dc68cbee6c246fa5965788fd (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
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.schema;

import com.yahoo.document.Field;
import com.yahoo.schema.document.SDDocumentType;
import com.yahoo.schema.document.SDField;

/**
 * @author Einar M R Rosenvinge
 */
public class FieldOperationApplier {

    public void process(SDDocumentType sdoc) {
        if (!sdoc.isStruct()) {
            apply(sdoc);
        }
    }

    protected void apply(SDDocumentType type) {
        for (Field field : type.fieldSet()) {
            apply(field);
        }
    }

    protected void apply(Field field) {
        if (field instanceof SDField) {
            SDField sdField = (SDField) field;
            sdField.applyOperations();
        }
    }

}