aboutsummaryrefslogtreecommitdiffstats
path: root/container-search/src/main/java/com/yahoo/search/query/profile/ModelObjectMap.java
blob: 059df807724865b9d8f38d3e12e8a3c2a2e16d3c (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
// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.search.query.profile;

import com.yahoo.processing.request.CompoundName;
import com.yahoo.search.query.profile.types.FieldType;
import com.yahoo.search.query.properties.PropertyMap;

/**
 * A map which stores all types which cannot be stored in a query profile
 * that is rich model objects.
 * <p>
 * This map will deep copy not only the model object map, but also each
 * clonable member in the map.
 *
 * @author bratseth
 */
public class ModelObjectMap extends PropertyMap {

    /** Returns true if the class of the value is not acceptable as a query profile value */
    @Override
    protected boolean shouldSet(CompoundName name,Object value) {
        if (value==null) return true;
        return FieldType.fromClass(value.getClass())==null;
    }

}