Package org.nuxeo.lib.stream.computation
Class Record
- java.lang.Object
-
- org.nuxeo.lib.stream.computation.Record
-
- All Implemented Interfaces:
Externalizable
,Serializable
public class Record extends Object implements Externalizable
Basic data object that contains: key, watermark, flag and data.- Since:
- 9.3
- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
Record.Flag
-
Field Summary
Fields Modifier and Type Field Description protected String
appenderThread
protected byte[]
data
protected EnumSet<Record.Flag>
flags
protected byte
flagsAsByte
protected String
key
protected static byte[]
NO_DATA
protected byte[]
traceContext
protected long
watermark
-
Constructor Summary
Constructors Constructor Description Record()
Record(String key, byte[] data)
Creates a record using current watermark corresponding to the current time, with a default flagRecord(String key, byte[] data, long watermark)
Creates a record using a default flagRecord(String key, byte[] data, long watermark, EnumSet<Record.Flag> flags)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description String
dataOverview(int maxLength)
protected EnumSet<Record.Flag>
decodeFlags(byte encoded)
protected short
encodeFlags(EnumSet<Record.Flag> enumSet)
boolean
equals(Object o)
String
getAppenderThread()
byte[]
getData()
EnumSet<Record.Flag>
getFlags()
byte
getFlagsAsByte()
String
getKey()
byte[]
getTraceContext()
long
getWatermark()
int
hashCode()
static Record
of(String key, byte[] data)
Creates a record using current timestamp and default flagvoid
readExternal(ObjectInput in)
void
setData(byte[] data)
void
setFlags(byte flagsAsByte)
void
setFlags(EnumSet<Record.Flag> flags)
void
setKey(String key)
void
setWatermark(long watermark)
String
toString()
void
writeExternal(ObjectOutput out)
-
-
-
Field Detail
-
NO_DATA
protected static final byte[] NO_DATA
-
watermark
protected long watermark
-
key
protected String key
-
data
@Nullable protected byte[] data
-
flags
protected transient EnumSet<Record.Flag> flags
-
flagsAsByte
protected byte flagsAsByte
-
traceContext
@Nullable protected byte[] traceContext
- Since:
- 11.1 used for tracing context propagation
-
appenderThread
@Nullable protected String appenderThread
-
-
Constructor Detail
-
Record
public Record()
-
Record
public Record(String key, byte[] data)
Creates a record using current watermark corresponding to the current time, with a default flag
-
Record
public Record(String key, byte[] data, long watermark)
Creates a record using a default flag
-
Record
public Record(String key, byte[] data, long watermark, EnumSet<Record.Flag> flags)
-
-
Method Detail
-
of
public static Record of(String key, byte[] data)
Creates a record using current timestamp and default flag
-
getWatermark
public long getWatermark()
-
setWatermark
public void setWatermark(long watermark)
-
getFlags
public EnumSet<Record.Flag> getFlags()
-
setFlags
public void setFlags(EnumSet<Record.Flag> flags)
-
setFlags
public void setFlags(byte flagsAsByte)
-
getKey
public String getKey()
-
setKey
public void setKey(String key)
-
getData
public byte[] getData()
-
setData
public void setData(byte[] data)
-
dataOverview
public String dataOverview(int maxLength)
-
writeExternal
public void writeExternal(ObjectOutput out) throws IOException
- Specified by:
writeExternal
in interfaceExternalizable
- Throws:
IOException
-
readExternal
public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException
- Specified by:
readExternal
in interfaceExternalizable
- Throws:
IOException
ClassNotFoundException
-
encodeFlags
protected short encodeFlags(EnumSet<Record.Flag> enumSet)
-
decodeFlags
protected EnumSet<Record.Flag> decodeFlags(byte encoded)
-
getFlagsAsByte
public byte getFlagsAsByte()
-
getTraceContext
public byte[] getTraceContext()
-
getAppenderThread
public String getAppenderThread()
-
-