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

org.graylog2.rest.models.messages.responses.ResultMessageSummary Maven / Gradle / Ivy

There is a newer version: 5.2.7
Show newest version
/**
 * This file is part of Graylog.
 *
 * Graylog is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * Graylog is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with Graylog.  If not, see .
 */
package org.graylog2.rest.models.messages.responses;

import com.fasterxml.jackson.annotation.JsonAutoDetect;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.google.auto.value.AutoValue;
import com.google.common.collect.Multimap;
import com.google.common.collect.Range;
import org.graylog.autovalue.WithBeanGetter;

import javax.annotation.Nullable;
import java.util.Map;

@AutoValue
@WithBeanGetter
@JsonAutoDetect
public abstract class ResultMessageSummary {
    private static final String FIELD_HIGHLIGHT_RANGES = "highlight_ranges";
    private static final String FIELD_MESSAGE = "message";
    private static final String FIELD_INDEX = "index";
    private static final String FIELD_DECORATION_STATS = "decoration_stats";

    @JsonProperty(FIELD_HIGHLIGHT_RANGES)
    @Nullable
    public abstract Multimap> highlightRanges();

    @JsonProperty(FIELD_MESSAGE)
    public abstract Map message();

    @JsonProperty(FIELD_INDEX)
    public abstract String index();

    @JsonProperty(FIELD_DECORATION_STATS)
    @Nullable
    public abstract DecorationStats decorationStats();

    private static Builder builder() {
        return new AutoValue_ResultMessageSummary.Builder();
    }

    public abstract Builder toBuilder();

    @JsonCreator
    public static ResultMessageSummary create(@Nullable @JsonProperty(FIELD_HIGHLIGHT_RANGES) Multimap> highlightRanges,
                                              @JsonProperty(FIELD_MESSAGE) Map message,
                                              @JsonProperty(FIELD_INDEX) String index,
                                              @JsonProperty(FIELD_DECORATION_STATS) DecorationStats decorationStats) {
        return builder()
            .decorationStats(decorationStats)
            .highlightRanges(highlightRanges)
            .index(index)
            .message(message)
            .build();
    }

    public static ResultMessageSummary create(@Nullable @JsonProperty(FIELD_HIGHLIGHT_RANGES) Multimap> highlightRanges,
                                              @JsonProperty(FIELD_MESSAGE) Map message,
                                              @JsonProperty(FIELD_INDEX) String index) {
        return builder()
            .highlightRanges(highlightRanges)
            .index(index)
            .message(message)
            .build();
    }

    @AutoValue.Builder
    public static abstract class Builder {
        public abstract Builder highlightRanges(Multimap> highlightRanges);

        public abstract Builder message(Map message);

        public abstract Builder index(String index);

        public abstract Builder decorationStats(DecorationStats decorationStats);

        public abstract ResultMessageSummary build();
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy