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

import com.yahoo.document.DocumentType;
import com.yahoo.document.StructDataType;

/**
 * Proxy for a struct type declared in a specific document
 *
 * @author arnej
 **/
public final class OwnedTemporaryType extends StructDataType implements OwnedType {

    private final String ownerName;
    private final String uniqueName;

    public OwnedTemporaryType(String name, DocumentType document) {
        this(name, document.getName());
    }

    public OwnedTemporaryType(String name, String owner) {
        super(name);
        this.ownerName = owner;
        this.uniqueName = name + "@" + owner;
    }

    @Override
    public String getOwnerName() {
        return ownerName;
    }

    @Override
    public String getUniqueName() {
        return uniqueName;
    }

    @Override
    public String toString() {
        return "{OwnedTemporaryType "+uniqueName+" id="+getId()+" uid="+getUniqueId()+"}";
    }
}