Class MetricImpl<T>

    • Field Detail

      • IDENTITY_CONVERTER

        public final Function<Object,​T> IDENTITY_CONVERTER
        Identity converter. It returns the raw value unchanged IFF the value's type can be cast to the generic type of this attribute, otherwise it returns null.
      • BYTES_TO_GB_CONVERTER

        public static final Function<Object,​Double> BYTES_TO_GB_CONVERTER
        Bytes to gigabytes converter. Supports converting number or string representations of raw values expressed in bytes.
      • name

        protected final String name
      • internalName

        protected final String internalName
    • Constructor Detail

      • MetricImpl

        public MetricImpl​(String name,
                          String internalName)
        Create a metric attribute.
        Parameters:
        name - short-hand name that identifies this attribute.
        internalName - internal name of a Solr metric.
      • MetricImpl

        public MetricImpl​(String name,
                          String internalName,
                          Function<Object,​T> converter)
        Create a metric attribute.
        Parameters:
        name - short-hand name that identifies this attribute.
        internalName - internal name of a Solr metric.
        converter - optional raw value converter. If null then IDENTITY_CONVERTER will be used.
    • Method Detail

      • getName

        public String getName()
        Description copied from interface: Metric
        Return the short-hand name that identifies this attribute.
        Specified by:
        getName in interface Metric<T>
      • getInternalName

        public String getInternalName()
        Description copied from interface: Metric
        Return the internal name of a Solr metric associated with this attribute.
        Specified by:
        getInternalName in interface Metric<T>
      • convert

        public T convert​(Object value)
        Description copied from interface: Metric
        Convert raw value. This may involve changing raw value type or units.
        Specified by:
        convert in interface Metric<T>
        Parameters:
        value - raw value
        Returns:
        converted value
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object