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

org.elasticsearch.client.ml.GetDataFrameAnalyticsResponse Maven / Gradle / Ivy

There is a newer version: 8.0.0-alpha2
Show newest version
/*
 * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
 * or more contributor license agreements. Licensed under the Elastic License
 * 2.0 and the Server Side Public License, v 1; you may not use this file except
 * in compliance with, at your election, the Elastic License 2.0 or the Server
 * Side Public License, v 1.
 */

package org.elasticsearch.client.ml;

import org.elasticsearch.client.ml.dataframe.DataFrameAnalyticsConfig;
import org.elasticsearch.xcontent.ConstructingObjectParser;
import org.elasticsearch.xcontent.ParseField;
import org.elasticsearch.xcontent.XContentParser;

import java.util.List;
import java.util.Objects;

import static org.elasticsearch.xcontent.ConstructingObjectParser.constructorArg;

public class GetDataFrameAnalyticsResponse {

    public static final ParseField DATA_FRAME_ANALYTICS = new ParseField("data_frame_analytics");

    @SuppressWarnings("unchecked")
    static final ConstructingObjectParser PARSER = new ConstructingObjectParser<>(
        "get_data_frame_analytics",
        true,
        args -> new GetDataFrameAnalyticsResponse((List) args[0])
    );

    static {
        PARSER.declareObjectArray(constructorArg(), (p, c) -> DataFrameAnalyticsConfig.fromXContent(p), DATA_FRAME_ANALYTICS);
    }

    public static GetDataFrameAnalyticsResponse fromXContent(final XContentParser parser) {
        return PARSER.apply(parser, null);
    }

    private List analytics;

    public GetDataFrameAnalyticsResponse(List analytics) {
        this.analytics = analytics;
    }

    public List getAnalytics() {
        return analytics;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        GetDataFrameAnalyticsResponse other = (GetDataFrameAnalyticsResponse) o;
        return Objects.equals(this.analytics, other.analytics);
    }

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




© 2015 - 2024 Weber Informatics LLC | Privacy Policy