Class MetricImpl<T>
- java.lang.Object
-
- org.apache.solr.cluster.placement.impl.MetricImpl<T>
-
- All Implemented Interfaces:
Metric<T>
- Direct Known Subclasses:
NodeMetricImpl,ReplicaMetricImpl
public abstract class MetricImpl<T> extends Object implements Metric<T>
Base class forMetricimplementations.
-
-
Field Summary
Fields Modifier and Type Field Description static Function<Object,Double>BYTES_TO_GB_CONVERTERBytes to gigabytes converter.protected Function<Object,T>converterstatic doubleGBFunction<Object,T>IDENTITY_CONVERTERIdentity converter.protected StringinternalNameprotected Stringname
-
Constructor Summary
Constructors Constructor Description MetricImpl(String name, String internalName)Create a metric attribute.MetricImpl(String name, String internalName, Function<Object,T> converter)Create a metric attribute.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Tconvert(Object value)Convert raw value.booleanequals(Object o)StringgetInternalName()Return the internal name of a Solr metric associated with this attribute.StringgetName()Return the short-hand name that identifies this attribute.inthashCode()StringtoString()
-
-
-
Field Detail
-
GB
public static final double GB
- See Also:
- Constant Field Values
-
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 thenIDENTITY_CONVERTERwill be used.
-
-
Method Detail
-
getName
public String getName()
Description copied from interface:MetricReturn the short-hand name that identifies this attribute.
-
getInternalName
public String getInternalName()
Description copied from interface:MetricReturn the internal name of a Solr metric associated with this attribute.- Specified by:
getInternalNamein interfaceMetric<T>
-
convert
public T convert(Object value)
Description copied from interface:MetricConvert raw value. This may involve changing raw value type or units.
-
-