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

org.mockserver.model.JsonPathBody Maven / Gradle / Ivy

There is a newer version: 5.15.0
Show newest version
package org.mockserver.model;

import java.util.Objects;

/**
 * @author jamesdbloom
 */
public class JsonPathBody extends Body {
    private int hashCode;
    private final String jsonPath;

    public JsonPathBody(String jsonPath) {
        super(Type.JSON_PATH);
        this.jsonPath = jsonPath;
    }

    public static JsonPathBody jsonPath(String jsonPath) {
        return new JsonPathBody(jsonPath);
    }

    public String getValue() {
        return jsonPath;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) {
            return true;
        }
        if (o == null || getClass() != o.getClass()) {
            return false;
        }
        if (hashCode() != o.hashCode()) {
            return false;
        }
        if (!super.equals(o)) {
            return false;
        }
        JsonPathBody that = (JsonPathBody) o;
        return Objects.equals(jsonPath, that.jsonPath);
    }

    @Override
    public int hashCode() {
        if (hashCode == 0) {
            hashCode = Objects.hash(super.hashCode(), jsonPath);
        }
        return hashCode;
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy