Module org.elasticsearch.xcore
Class EnumCounters<E extends Enum<E>>
java.lang.Object
org.elasticsearch.xpack.core.common.stats.EnumCounters<E>
- All Implemented Interfaces:
Writeable
Utility class similar to org.elasticsearch.xpack.core.watcher.common.stats.Counters, but it is using Enum instead
of string to identify the counter. The serialization happens using enum ordinals similar to
StreamOutput.writeEnum(Enum), which means that ordinal for existing enums should remain the same for backward
and forward compatibility of the serialization protocol.-
Nested Class Summary
Nested classes/interfaces inherited from interface org.elasticsearch.common.io.stream.Writeable
Writeable.Reader<V>, Writeable.Writer<V> -
Constructor Summary
ConstructorsConstructorDescriptionEnumCounters(Class<E> enumClass) EnumCounters(StreamInput in, Class<E> enumClass) -
Method Summary
Modifier and TypeMethodDescriptionbooleanlongbooleaninthashCode()voidvoidstatic <E extends Enum<E>>
EnumCounters<E> merge(Class<E> enumClass, List<EnumCounters<E>> counters) voidlongsize()toMap()toString()voidwriteTo(StreamOutput out)
-
Constructor Details
-
EnumCounters
-
EnumCounters
- Throws:
IOException
-
-
Method Details
-
writeTo
- Specified by:
writeToin interfaceWriteable- Throws:
IOException
-
set
-
inc
-
inc
-
get
-
size
public long size() -
hasCounters
public boolean hasCounters() -
toMap
-
merge
public static <E extends Enum<E>> EnumCounters<E> merge(Class<E> enumClass, List<EnumCounters<E>> counters) -
equals
-
hashCode
public int hashCode() -
toString
-