All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.yahoo.vespa.applicationmodel.ConfigId Maven / Gradle / Ivy

// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.vespa.applicationmodel;

import com.fasterxml.jackson.annotation.JsonValue;

import java.util.Objects;

/**
 * @author bjorncs
 */
public class ConfigId {

    private final String id;

    public ConfigId(String id) {
        this.id = id;
    }

    // Jackson's StdKeySerializer uses toString() (and ignores annotations) for objects used as Map keys.
    // Therefore, we use toString() as the JSON-producing method, which is really sad.
    @JsonValue
    @Override
    public String toString() {
        return id;
    }

    public String s() { // For compatibility with original Scala case class
        return id;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        ConfigId configId = (ConfigId) o;
        return Objects.equals(id, configId.id);
    }

    @Override
    public int hashCode() {
        return Objects.hash(id);
    }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy