public class Event extends Object
| Constructor and Description |
|---|
Event(LibHoney libhoney,
Builder builder)
Constructs a new Event with a default metadata string inherited from LibHoney.
|
Event(LibHoney libhoney,
Builder builder,
String metadata)
Constructs a new Event from a Builder, executing all dynamic fields and storing them as fields.
|
| Modifier and Type | Method and Description |
|---|---|
void |
add(Map<String,Object> fields)
Copies all of the field mappings from the specified map to this Builder.
|
void |
addField(String key,
Object value)
Associates the specified value with the specified key in the fields map.
|
String |
getCreatedAt()
Returns the time when this Event was created.
|
String |
getDataSet()
Returns the data set identifier for this Event.
|
Map<String,Object> |
getFields()
Returns fields for this Event.
|
String |
getMetadata()
Returns the metadata string for this Event.
|
int |
getSampleRate()
Returns the sample rate for this Event.
|
String |
getWriteKey()
Returns the write key for this Event.
|
void |
send()
Enqueues this Event with Transmission as a request, or as a dropped response if it should be dropped.
|
void |
setDataSet(String dataSet)
Sets the data set
|
void |
setMetadata(String metadata)
Sets the metadata string
|
void |
setSampleRate(int sampleRate)
Sets the sample rate
|
void |
setWriteKey(String writeKey)
Sets the write key
|
boolean |
shouldSendEvent()
Returns true if this Event should be dropped (due to the sample rate).
|
org.json.JSONObject |
toJson()
Returns a JSON representation of this Event.
|
String |
toString()
Returns a string representation of this Event.
|
public Event(LibHoney libhoney, Builder builder)
libhoney - LibHoneybuilder - builder from which this Event is builtpublic void add(Map<String,Object> fields)
fields - field mappings to be added to this Builderpublic void addField(String key, Object value)
key - key with which the specified value is to be associatedvalue - value to be associated with the specified keypublic String getCreatedAt()
public String getDataSet()
public Map<String,Object> getFields()
public String getMetadata()
public int getSampleRate()
public String getWriteKey()
public void send()
throws HoneyException
HoneyException - if there is something wrong with the requestpublic void setDataSet(String dataSet)
dataSet - data setpublic void setMetadata(String metadata)
metadata - metadata stringpublic void setSampleRate(int sampleRate)
sampleRate - sample ratepublic void setWriteKey(String writeKey)
writeKey - write keypublic boolean shouldSendEvent()
public org.json.JSONObject toJson()
Copyright © 2017. All rights reserved.