aboutsummaryrefslogtreecommitdiffstats
path: root/document/src/vespa/document/fieldvalue/collectionfieldvalue.cpp
blob: b9400a1e66316e90671fc146155671d3dfdf0d1e (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
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.

#include "collectionfieldvalue.h"
#include <vespa/vespalib/util/exceptions.h>

namespace document {


CollectionFieldValue::CollectionFieldValue(const CollectionFieldValue& other)
    : FieldValue(other),
      _type(other._type)
{
}

void CollectionFieldValue::verifyType(const CollectionFieldValue& other) const
{
    if ( ! _type->equals(*other._type)) {
        throw vespalib::IllegalArgumentException(
                "Cannot assign value of type " + other.getDataType()->toString()
                + " to value of type " + getDataType()->toString() + ".",
                VESPA_STRLOC);
    }
}

}