public final class DefaultEvent extends java.lang.Object implements InternalEvent
| Modifier and Type | Method and Description |
|---|---|
void |
addAttribute(java.lang.String name,
java.lang.String value)
Adds an attribute to this
AnalyticsEvent with the specified key. |
void |
addMetric(java.lang.String name,
java.lang.Double value)
Adds a metric to this
AnalyticsEvent with the specified key. |
ClientContext |
createClientContext(java.lang.String networkType) |
static DefaultEvent |
createFromEvent(AnalyticsContext context,
java.lang.String sessionId,
long timestamp,
InternalEvent copyEvent) |
java.util.Map<java.lang.String,java.lang.String> |
getAllAttributes()
Returns a map of all attributes contained within this
AnalyticsEvent |
java.util.Map<java.lang.String,java.lang.Double> |
getAllMetrics()
Returns a map of all metrics contained within this
AnalyticsEvent |
java.lang.String |
getAttribute(java.lang.String name)
Returns the value of the attribute with the specified name.
|
java.lang.Long |
getEventTimestamp() |
java.lang.String |
getEventType()
Returns the name/type of this
AnalyticsEvent |
java.lang.Double |
getMetric(java.lang.String name)
Returns the value of the metric with the specified name.
|
java.lang.String |
getSdkName() |
java.lang.String |
getSdkVersion() |
java.lang.Long |
getSessionDuration() |
java.lang.String |
getSessionId() |
long |
getSessionStart() |
java.lang.Long |
getSessionStop() |
Id |
getUniqueId() |
boolean |
hasAttribute(java.lang.String attributeName)
Determines if this
AnalyticsEvent contains a specific attribute |
boolean |
hasMetric(java.lang.String metricName)
Determines if this
AnalyticsEvent contains a specific metric. |
static DefaultEvent |
newInstance(AnalyticsContext context,
java.lang.String sessionId,
java.lang.Long sessionStart,
java.lang.Long sessionEnd,
java.lang.Long duration,
long timestamp,
java.lang.String eventType) |
static DefaultEvent |
newInstance(java.lang.String eventType,
java.util.Map<java.lang.String,java.lang.String> attributes,
java.util.Map<java.lang.String,java.lang.Double> metrics,
SDKInfo sdkInfo,
java.lang.String sessionId,
java.lang.Long sessionStart,
java.lang.Long sessionStop,
java.lang.Long sessionDuration,
long timestamp,
Id uniqueId,
AppDetails appDetails,
DeviceDetails deviceDetails) |
org.json.JSONObject |
toJSONObject() |
java.lang.String |
toString() |
DefaultEvent |
withAttribute(java.lang.String name,
java.lang.String value)
Adds an attribute to this
AnalyticsEvent with the specified key. |
DefaultEvent |
withMetric(java.lang.String name,
java.lang.Double value)
Adds a metric to this
AnalyticsEvent with the specified key. |
public static DefaultEvent createFromEvent(AnalyticsContext context, java.lang.String sessionId, long timestamp, InternalEvent copyEvent)
public static DefaultEvent newInstance(AnalyticsContext context, java.lang.String sessionId, java.lang.Long sessionStart, java.lang.Long sessionEnd, java.lang.Long duration, long timestamp, java.lang.String eventType)
public static DefaultEvent newInstance(java.lang.String eventType, java.util.Map<java.lang.String,java.lang.String> attributes, java.util.Map<java.lang.String,java.lang.Double> metrics, SDKInfo sdkInfo, java.lang.String sessionId, java.lang.Long sessionStart, java.lang.Long sessionStop, java.lang.Long sessionDuration, long timestamp, Id uniqueId, AppDetails appDetails, DeviceDetails deviceDetails)
public void addAttribute(java.lang.String name,
java.lang.String value)
AnalyticsEventAnalyticsEvent with the specified key. Only 40 attributes/metrics
are allowed to be added to an Event. If 40 attribute/metrics already exist on this Event, the call may be ignored.addAttribute in interface AnalyticsEventname - The name of the attribute. The name will be truncated if it exceeds 50 characters.value - The value of the attribute. The value will be truncated if it exceeds 200 characters.public boolean hasAttribute(java.lang.String attributeName)
AnalyticsEventAnalyticsEvent contains a specific attributehasAttribute in interface AnalyticsEventattributeName - The name of the attributeAnalyticsEvent has an attribute with the specified name, false otherwisepublic void addMetric(java.lang.String name,
java.lang.Double value)
AnalyticsEventAnalyticsEvent with the specified key. Only 40 attributes/metrics
are allowed to be added to an Event. If 50 attribute/metrics already exist on this Event, the call may be ignored.addMetric in interface AnalyticsEventname - The name of the metric. The name will be truncated if it exceeds 50 characters.value - The value of the metric.public boolean hasMetric(java.lang.String metricName)
AnalyticsEventAnalyticsEvent contains a specific metric.hasMetric in interface AnalyticsEventmetricName - The name of the metricAnalyticsEvent has a metric with the specified name, false otherwisepublic java.lang.String getEventType()
AnalyticsEventAnalyticsEventgetEventType in interface AnalyticsEventAnalyticsEventpublic java.lang.String getAttribute(java.lang.String name)
AnalyticsEventgetAttribute in interface AnalyticsEventname - The name of the attribute to returnpublic java.lang.Double getMetric(java.lang.String name)
AnalyticsEventgetMetric in interface AnalyticsEventname - The name of the metric to returnpublic java.lang.String getSessionId()
getSessionId in interface InternalEventpublic java.lang.Long getEventTimestamp()
getEventTimestamp in interface InternalEventpublic Id getUniqueId()
getUniqueId in interface InternalEventpublic java.lang.String getSdkName()
getSdkName in interface InternalEventpublic java.lang.String getSdkVersion()
getSdkVersion in interface InternalEventpublic DefaultEvent withAttribute(java.lang.String name, java.lang.String value)
AnalyticsEventAnalyticsEvent with the specified key. Only 40 attributes/metrics
are allowed to be added to an AnalyticsEvent. If 40 attribute/metrics already exist on this AnalyticsEvent, the call may be ignored.withAttribute in interface AnalyticsEventname - The name of the attribute. The name will be truncated if it exceeds 50 characters.value - The value of the attribute. The value will be truncated if it exceeds 200 characters.AnalyticsEvent instance is returned to allow for method chaining.public DefaultEvent withMetric(java.lang.String name, java.lang.Double value)
AnalyticsEventAnalyticsEvent with the specified key. Only 40 attributes/metrics
are allowed to be added to an AnalyticsEvent. If 40 attribute/metrics already exist on this AnalyticsEvent, the call may be ignored.withMetric in interface AnalyticsEventname - The name of the metric. The name will be truncated if it exceeds 50 characters.value - The value of the metric.AnalyticsEvent instance is returned to allow for method chaining.public java.util.Map<java.lang.String,java.lang.String> getAllAttributes()
AnalyticsEventAnalyticsEventgetAllAttributes in interface AnalyticsEventpublic java.util.Map<java.lang.String,java.lang.Double> getAllMetrics()
AnalyticsEventAnalyticsEventgetAllMetrics in interface AnalyticsEventpublic java.lang.String toString()
toString in class java.lang.Objectpublic org.json.JSONObject toJSONObject()
toJSONObject in interface JSONSerializablepublic ClientContext createClientContext(java.lang.String networkType)
createClientContext in interface InternalEventpublic long getSessionStart()
getSessionStart in interface InternalEventpublic java.lang.Long getSessionStop()
getSessionStop in interface InternalEventpublic java.lang.Long getSessionDuration()
getSessionDuration in interface InternalEvent