java.lang.Object
org.rrd4j.core.RrdPrimitive<U>
org.rrd4j.core.RrdEnum<U,E>
- Type Parameters:
U- The type of RrdUpdater this primitive belongs toE- The enum type being stored
RRD primitive type for handling enum values.
This class provides methods to store and retrieve enum values in RRD files. It handles the conversion between enum constants and their string representations, with caching support for performance optimization.
Field Summary
FieldsFields inherited from class RrdPrimitive
RRD_DOUBLE, RRD_INT, RRD_LONG, RRD_PRIM_SIZES, RRD_STRING, STRING_LENGTHModifier and TypeFieldDescription(package private) static final intType identifier for double RRD primitives.(package private) static final intType identifier for integer RRD primitives.(package private) static final intType identifier for long RRD primitives.(package private) static final int[]Array containing the size in bytes for each RRD primitive type.(package private) static final intType identifier for string RRD primitives.(package private) static final intMaximum length of string values stored in RRD primitives.Constructor Summary
ConstructorsConstructorDescriptionRrdEnum(RrdUpdater<U> updater, boolean isConstant, Class<E> clazz) Create an enum-valued primitive.RrdEnum(RrdUpdater<U> updater, Class<E> clazz) Create a varying enum-valued primitive.Method Summary
All MethodsMethods inherited from class RrdPrimitive
isCachingAllowed, readBytes, readDouble, readDouble, readDouble, readEnum, readInt, readLong, readString, writeBytes, writeDouble, writeDouble, writeDouble, writeDouble, writeEnum, writeInt, writeLong, writeStringModifier and TypeMethodDescription(package private) final booleanChecks if caching is allowed for this primitive.(package private) final byte[]Raw byte array from backend storage.(package private) final doubleReads the double value from backend storage.(package private) final doublereadDouble(int index) Position in the primitive array.(package private) final double[]readDouble(int index, int count) Starting position in the primitive array.protected final <E extends Enum<E>>
EDeserialize an enum value from backend storage.(package private) final intreadInt()Reads the int value from backend storage.(package private) final longreadLong()Reads the long value from backend storage.(package private) final StringReads the string value from backend storage.(package private) final voidwriteBytes(byte[] b) Byte array to write to backend storage.(package private) final voidwriteDouble(double value) Double value to write to backend storage.(package private) final voidwriteDouble(int index, double value) Position in the primitive array.(package private) final voidwriteDouble(int index, double[] values) Starting position in the primitive array.(package private) final voidwriteDouble(int index, double value, int count) Starting position in the primitive array.protected final <E extends Enum<E>>
voidwriteEnum(E value) Serialize an enum value to backend storage.(package private) final voidwriteInt(int value) Int value to write to backend storage.(package private) final voidwriteLong(long value) Long value to write to backend storage.(package private) final voidwriteString(String value) String value to write to backend storage.
Field Details
cache
clazz
Constructor Details
RrdEnum
RrdEnum(RrdUpdater<U> updater, boolean isConstant, Class<E> clazz) Create an enum-valued primitive.- Parameters:
updater- the source of valuesisConstant- true to read a constant rather than a varying valueclazz- the enum type to read and write
RrdEnum
RrdEnum(RrdUpdater<U> updater, Class<E> clazz) Create a varying enum-valued primitive.- Parameters:
updater- the source of valuesclazz- the enum type to read and write
Method Details
set
Store an enum value with optional caching.- Parameters:
value- the enum value to set- Throws:
IOException- if an I/O error occurs
get
Retrieve the stored enum value.- Returns:
- the stored enum
- Throws:
IOException- if an I/O error occurs
name
Gets the name of the enum value.- Returns:
- the name of the enum value
- Throws:
IOException- if an I/O error occurs