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

com.chutneytesting.scenario.domain.gwt.Strategy Maven / Gradle / Ivy

The newest version!
/*
 * SPDX-FileCopyrightText: 2017-2024 Enedis
 *
 * SPDX-License-Identifier: Apache-2.0
 *
 */

package com.chutneytesting.scenario.domain.gwt;

import static java.util.Collections.emptyMap;
import static java.util.Optional.empty;
import static java.util.Optional.ofNullable;

import java.util.Map;
import java.util.Objects;
import java.util.Optional;

public class Strategy {

    public static final Optional NONE = empty();
    public static final Strategy DEFAULT = new Strategy("", emptyMap());

    public final String type;
    public final Map parameters;

    public Strategy(String type, Map parameters) {
        this.type = ofNullable(type).orElse("");
        this.parameters = ofNullable(parameters).orElse(emptyMap());
    }

    @Override
    public String toString() {
        return "Strategy{" +
            "type='" + type + '\'' +
            ", parameters=" + parameters +
            '}';
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        Strategy strategy = (Strategy) o;
        return type.equals(strategy.type) &&
            parameters.equals(strategy.parameters);
    }

    @Override
    public int hashCode() {
        return Objects.hash(type, parameters);
    }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy