Class Metric<G extends java.io.Serializable>

    • Field Detail

      • DEFAULT_DECIMAL_SCALE

        public static final int DEFAULT_DECIMAL_SCALE
        Since:
        5.3
        See Also:
        Constant Field Values
      • MAX_DECIMAL_SCALE

        public static final int MAX_DECIMAL_SCALE
        The maximum supported value of scale for decimal metrics
        Since:
        5.3
        See Also:
        Constant Field Values
      • DIRECTION_WORST

        public static final int DIRECTION_WORST
        A metric bigger value means a degradation
        See Also:
        Constant Field Values
      • DIRECTION_BETTER

        public static final int DIRECTION_BETTER
        A metric bigger value means an improvement
        See Also:
        Constant Field Values
      • DIRECTION_NONE

        public static final int DIRECTION_NONE
        The metric direction has no meaning
        See Also:
        Constant Field Values
    • Constructor Detail

      • Metric

        @Deprecated
        public Metric()
        Deprecated.
        in 1.12. Use the Metric.Builder factory.
        Creates an empty metric
      • Metric

        @Deprecated
        public Metric​(java.lang.String key)
        Deprecated.
        since 2.7 use the Metric.Builder factory.
        Creates a metric based on its key. Shortcut to Metric(key, ValueType.INT)
        Parameters:
        key - the metric key
      • Metric

        @Deprecated
        public Metric​(java.lang.String key,
                      Metric.ValueType type)
        Deprecated.
        since 2.7 use the Metric.Builder factory.
        Creates a metric based on a key and a type. Shortcut to Metric(key, key, key, type, -1, Boolean.FALSE, null, false)
        Parameters:
        key - the key
        type - the type
      • Metric

        @Deprecated
        public Metric​(java.lang.String key,
                      java.lang.String name,
                      java.lang.String description,
                      Metric.ValueType type,
                      java.lang.Integer direction,
                      java.lang.Boolean qualitative,
                      java.lang.String domain)
        Deprecated.
        since 2.7 use the Metric.Builder factory.
    • Method Detail

      • getUuid

        public java.lang.String getUuid()
        For internal use only
      • setUuid

        public Metric<G> setUuid​(@Nullable
                                 java.lang.String uuid)
        For internal use only
      • getQualitative

        public java.lang.Boolean getQualitative()
        Returns:
        wether the metric is qualitative
      • setQualitative

        public Metric<G> setQualitative​(java.lang.Boolean qualitative)
        Sets whether the metric is qualitative
        Parameters:
        qualitative - whether the metric is qualitative
        Returns:
        this
      • getKey

        public java.lang.String getKey()
        Returns:
        the metric key
      • setKey

        public Metric<G> setKey​(java.lang.String key)
        Sets the metric key
        Parameters:
        key - the key
        Returns:
        this
      • setType

        public Metric<G> setType​(Metric.ValueType type)
        Sets the metric type
        Parameters:
        type - the type
        Returns:
        this
      • getDescription

        @CheckForNull
        public java.lang.String getDescription()
        Returns:
        the metric description
      • setDescription

        public Metric<G> setDescription​(@Nullable
                                        java.lang.String description)
        Sets the metric description
        Parameters:
        description - the description
        Returns:
        this
      • getUserManaged

        public java.lang.Boolean getUserManaged()
        Returns:
        whether the metric is a managed by the users ("manual metric")
      • setUserManaged

        public Metric<G> setUserManaged​(java.lang.Boolean userManaged)
        Sets whether the metric is managed by users ("manual metric")
        Parameters:
        userManaged - whether the metric is user managed
        Returns:
        this
      • getEnabled

        public java.lang.Boolean getEnabled()
        Returns:
        whether the metric is enabled
      • setEnabled

        public Metric<G> setEnabled​(java.lang.Boolean enabled)
        Sets whether the metric is enabled
        Parameters:
        enabled - whether the metric is enabled
        Returns:
        this
      • getDirection

        public java.lang.Integer getDirection()
        Returns:
        the metric direction
      • setDirection

        public Metric<G> setDirection​(java.lang.Integer direction)
        Sets the metric direction.
        Parameters:
        direction - the direction
      • getDomain

        public java.lang.String getDomain()
        Returns:
        the domain of the metric
      • setDomain

        public Metric<G> setDomain​(java.lang.String domain)
        Sets the domain for the metric (General, Complexity...)
        Parameters:
        domain - the domain
        Returns:
        this
      • getName

        public java.lang.String getName()
        Returns:
        the metric name
      • setName

        public Metric<G> setName​(java.lang.String name)
        Sets the metric name
        Parameters:
        name - the name
        Returns:
        this
      • getWorstValue

        public java.lang.Double getWorstValue()
      • getBestValue

        @CheckForNull
        public java.lang.Double getBestValue()
      • setWorstValue

        public Metric<G> setWorstValue​(@Nullable
                                       java.lang.Double d)
        Returns:
        this
      • setBestValue

        public Metric<G> setBestValue​(@Nullable
                                      java.lang.Double bestValue)
        Parameters:
        bestValue - the best value. It can be null.
        Returns:
        this
      • isNumericType

        public boolean isNumericType()
        Returns:
        whether the metric is of a numeric type (int, percentage...)
      • isDataType

        public boolean isDataType()
        Returns:
        whether the metric is of type data
      • isPercentageType

        public boolean isPercentageType()
        Returns:
        whether the metric is of type percentage
      • setOptimizedBestValue

        public Metric<G> setOptimizedBestValue​(@Nullable
                                               java.lang.Boolean b)
      • isOptimizedBestValue

        @CheckForNull
        public java.lang.Boolean isOptimizedBestValue()
        Returns:
        null for manual metrics
      • isHidden

        public java.lang.Boolean isHidden()
      • setHidden

        public Metric<G> setHidden​(java.lang.Boolean hidden)
      • getDeleteHistoricalData

        public java.lang.Boolean getDeleteHistoricalData()
      • getDecimalScale

        @CheckForNull
        public java.lang.Integer getDecimalScale()
        Return the number scale if metric type is Metric.ValueType.FLOAT, else null
        Since:
        5.3
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • equals

        public boolean equals​(java.lang.Object obj)
        Overrides:
        equals in class java.lang.Object
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • merge

        public Metric<G> merge​(Metric with)
        Merge with fields from other metric. All fields are copied, except the id.
        Returns:
        this
      • key

        public java.lang.String key()
        Specified by:
        key in interface Metric<G extends java.io.Serializable>
      • valueType

        public java.lang.Class<G> valueType()
        Specified by:
        valueType in interface Metric<G extends java.io.Serializable>