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

com.atlan.model.search.AggregationResult Maven / Gradle / Ivy

// Generated by delombok at Thu Oct 10 18:56:33 UTC 2024
/* SPDX-License-Identifier: Apache-2.0
   Copyright 2022 Atlan Pte. Ltd. */
package com.atlan.model.search;

import com.atlan.exception.ErrorCode;
import com.atlan.exception.InvalidRequestException;
import com.atlan.model.core.AtlanObject;
import com.fasterxml.jackson.annotation.JsonIgnore;

/**
 * Base class for all aggregation results in a search.
 */
public abstract class AggregationResult extends AtlanObject {
    private static final long serialVersionUID = 2L;

    /**
     * Retrieve the numeric value from the provided aggregation result.
     *
     * @return the numeric result for the aggregation
     * @throws InvalidRequestException if the provided aggregation result is not a metric
     */
    @JsonIgnore
    public Double getMetric() throws InvalidRequestException {
        if (this instanceof AggregationMetricResult) {
            return ((AggregationMetricResult) this).getValue();
        } else {
            throw new InvalidRequestException(ErrorCode.NOT_AGGREGATION_METRIC);
        }
    }

    @java.lang.Override
    @java.lang.SuppressWarnings("all")
    @lombok.Generated
    public java.lang.String toString() {
        return "AggregationResult(super=" + super.toString() + ")";
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy