aboutsummaryrefslogtreecommitdiffstats
path: root/container-search/src/main/java/com/yahoo/search/query/textserialize/item/ItemArguments.java
blob: 5b168d1fff85de8116a3fe00d7a3dfe05736e5b1 (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 Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.search.query.textserialize.item;

import java.util.Collections;
import java.util.List;
import java.util.Map;

import static com.yahoo.search.query.textserialize.item.ListUtil.firstInstanceOf;

/**
 * @author Tony Vaagenes
 */
public class ItemArguments {
    public final Map<?, ?> properties;
    public final List<Object> children;

    public ItemArguments(List<Object> arguments) {
        if (firstInstanceOf(arguments, Map.class)) {
            properties = (Map<?, ?>) ListUtil.first(arguments);
            children = ListUtil.rest(arguments);
        } else {
            properties = Collections.emptyMap();
            children = arguments;
        }
    }
}