public abstract class BaseTelemetry<T extends SendableData> extends java.lang.Object implements Telemetry
Modifier | Constructor and Description |
---|---|
protected |
BaseTelemetry() |
Modifier and Type | Method and Description |
---|---|
protected abstract void |
additionalSanitize()
Concrete classes should implement this method
|
TelemetryContext |
getContext()
Gets the context associated with the current telemetry item.
|
protected abstract T |
getData()
Concrete classes should implement this method which supplies the
data structure that this instance works with, which needs to implement
SendableData |
java.util.Map<java.lang.String,java.lang.String> |
getProperties()
Gets a dictionary of application-defined property names and values providing additional information about this event.
|
java.lang.String |
getSequence()
Sequence field used to track absolute order of uploaded events.
|
java.util.Date |
getTimestamp()
Gets date and time when event was recorded.
|
protected void |
initialize(java.util.concurrent.ConcurrentMap<java.lang.String,java.lang.String> properties)
Initializes the instance with the context properties
|
void |
sanitize()
Makes sure the data to send is sanitized from bad chars, proper length etc.
|
void |
serialize(JsonTelemetryDataSerializer writer)
Serializes this object in JSON format.
|
void |
setSequence(java.lang.String sequence)
Sets the value that defines absolute order of the telemetry item.
|
void |
setTimestamp(java.util.Date date)
Sets date and time when event was recorded.
|
protected void initialize(java.util.concurrent.ConcurrentMap<java.lang.String,java.lang.String> properties)
properties
- The context propertiespublic java.lang.String getSequence()
getSequence
in interface Telemetry
public void setSequence(java.lang.String sequence)
setSequence
in interface Telemetry
sequence
- The sequence of the Telemetry.public java.util.Date getTimestamp()
getTimestamp
in interface Telemetry
public void setTimestamp(java.util.Date date)
setTimestamp
in interface Telemetry
date
- The timestamp as Date.public TelemetryContext getContext()
getContext
in interface Telemetry
public java.util.Map<java.lang.String,java.lang.String> getProperties()
getProperties
in interface Telemetry
public void sanitize()
public void serialize(JsonTelemetryDataSerializer writer) throws java.io.IOException
serialize
in interface JsonSerializable
serialize
in interface Telemetry
writer
- The writer that helps with serializing into Json formatjava.io.IOException
- The exception that might be thrown during the serializationprotected abstract void additionalSanitize()
protected abstract T getData()
SendableData