public class AnalyticsEvent
extends java.lang.Object
implements com.amazonaws.mobileconnectors.pinpoint.internal.core.util.JSONSerializable
| 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. |
com.amazonaws.mobileconnectors.pinpoint.internal.event.ClientContext |
createClientContext(java.lang.String networkType)
Creates a ClientContext object
|
static AnalyticsEvent |
createFromEvent(com.amazonaws.mobileconnectors.pinpoint.internal.core.PinpointContext context,
java.lang.String sessionId,
long timestamp,
AnalyticsEvent copyEvent)
Creates a copy of an event with specified parameters
|
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 |
com.amazonaws.mobileconnectors.pinpoint.internal.core.system.AndroidAppDetails |
getAppDetails()
Returns the App specific information
|
java.lang.String |
getAttribute(java.lang.String name)
Returns the value of the attribute with the specified name.
|
java.lang.String |
getEventId()
Returns the eventId
|
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() |
PinpointSession |
getSession() |
java.lang.String |
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 AnalyticsEvent |
newInstance(com.amazonaws.mobileconnectors.pinpoint.internal.core.PinpointContext context,
java.lang.String sessionId,
java.lang.Long sessionStart,
java.lang.Long sessionEnd,
java.lang.Long duration,
long timestamp,
java.lang.String eventType)
Creates a new instance of an AnalyticsEvent
|
static AnalyticsEvent |
newInstance(java.lang.String eventId,
java.lang.String eventType,
java.util.Map<java.lang.String,java.lang.String> attributes,
java.util.Map<java.lang.String,java.lang.Double> metrics,
com.amazonaws.mobileconnectors.pinpoint.internal.core.util.SDKInfo sdkInfo,
java.lang.String sessionId,
java.lang.Long sessionStart,
java.lang.Long sessionStop,
java.lang.Long sessionDuration,
long timestamp,
java.lang.String uniqueId,
com.amazonaws.mobileconnectors.pinpoint.internal.core.system.AndroidAppDetails appDetails,
com.amazonaws.mobileconnectors.pinpoint.internal.core.system.AndroidDeviceDetails deviceDetails)
Creates a new instance of an AnalyticsEvent
|
org.json.JSONObject |
toJSONObject() |
java.lang.String |
toString() |
static org.json.JSONObject |
translateFromEvent(AnalyticsEvent source)
Translates an event to a JSONObject
|
static AnalyticsEvent |
translateToEvent(org.json.JSONObject source)
Transforms a JSONObject into an event
|
AnalyticsEvent |
withAttribute(java.lang.String name,
java.lang.String value)
Adds an attribute to this
AnalyticsEvent with the specified key. |
AnalyticsEvent |
withMetric(java.lang.String name,
java.lang.Double value)
Adds a metric to this
AnalyticsEvent with the specified key. |
public static AnalyticsEvent createFromEvent(com.amazonaws.mobileconnectors.pinpoint.internal.core.PinpointContext context, java.lang.String sessionId, long timestamp, AnalyticsEvent copyEvent)
context - The Pinpoint contextsessionId - The SessionId of the new eventtimestamp - The timestamp of the new eventcopyEvent - The event to be copiedpublic static AnalyticsEvent newInstance(com.amazonaws.mobileconnectors.pinpoint.internal.core.PinpointContext context, java.lang.String sessionId, java.lang.Long sessionStart, java.lang.Long sessionEnd, java.lang.Long duration, long timestamp, java.lang.String eventType)
context - The Pinpoint contextsessionId - The SessionId of the new eventsessionStart - The sessionStart of the new eventsessionEnd - The sessionEnd of the new eventduration - The session duration of the new eventtimestamp - The timestamp of the new eventeventType - The eventType of the new eventpublic static AnalyticsEvent newInstance(java.lang.String eventId, java.lang.String eventType, java.util.Map<java.lang.String,java.lang.String> attributes, java.util.Map<java.lang.String,java.lang.Double> metrics, com.amazonaws.mobileconnectors.pinpoint.internal.core.util.SDKInfo sdkInfo, java.lang.String sessionId, java.lang.Long sessionStart, java.lang.Long sessionStop, java.lang.Long sessionDuration, long timestamp, java.lang.String uniqueId, com.amazonaws.mobileconnectors.pinpoint.internal.core.system.AndroidAppDetails appDetails, com.amazonaws.mobileconnectors.pinpoint.internal.core.system.AndroidDeviceDetails deviceDetails)
eventId - The eventId of the new eventeventType - The eventType of the new eventattributes - A list of attributes of the new eventmetrics - A list of metrics of the new eventsdkInfo - The SDKInfo of the new eventsessionId - The SessionId of the new eventsessionStart - The sessionStart of the new eventsessionStop - The sessionStop of the new eventsessionDuration - The sessionDuration of the new eventtimestamp - The timestamp of the new eventuniqueId - The uniqueId of the new eventappDetails - The AndroidAppDetails of the new eventdeviceDetails - The AndroidDeviceDetails of the new eventpublic static org.json.JSONObject translateFromEvent(AnalyticsEvent source)
source - The event to transformJSONObjectpublic static AnalyticsEvent translateToEvent(org.json.JSONObject source) throws org.json.JSONException
source - The event as a JSONObjectorg.json.JSONExceptionpublic java.lang.String getEventId()
public void addAttribute(java.lang.String name,
java.lang.String value)
AnalyticsEvent 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.name - 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)
AnalyticsEvent contains a specific attributeattributeName - The name of the attributeAnalyticsEvent has an attribute with the
specified name, false otherwisepublic void addMetric(java.lang.String name,
java.lang.Double value)
AnalyticsEvent 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.name - 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)
AnalyticsEvent contains a specific metric.metricName - The name of the metricAnalyticsEvent has a metric with the
specified name, false otherwisepublic java.lang.String getEventType()
AnalyticsEventAnalyticsEventpublic java.lang.String getAttribute(java.lang.String name)
name - The name of the attribute to returnpublic java.lang.Double getMetric(java.lang.String name)
name - The name of the metric to returnpublic PinpointSession getSession()
public java.lang.Long getEventTimestamp()
public java.lang.String getUniqueId()
public java.lang.String getSdkName()
public java.lang.String getSdkVersion()
public AnalyticsEvent withAttribute(java.lang.String name, java.lang.String value)
AnalyticsEvent 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.name - 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 AnalyticsEvent withMetric(java.lang.String name, java.lang.Double value)
AnalyticsEvent 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.name - 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()
AnalyticsEventpublic java.util.Map<java.lang.String,java.lang.Double> getAllMetrics()
AnalyticsEventpublic com.amazonaws.mobileconnectors.pinpoint.internal.core.system.AndroidAppDetails getAppDetails()
public java.lang.String toString()
toString in class java.lang.Objectpublic org.json.JSONObject toJSONObject()
toJSONObject in interface com.amazonaws.mobileconnectors.pinpoint.internal.core.util.JSONSerializablepublic com.amazonaws.mobileconnectors.pinpoint.internal.event.ClientContext createClientContext(java.lang.String networkType)
networkType - The network type from the Pinpoint ContextClientContext objectCopyright © 2018 Amazon Web Services, Inc. All Rights Reserved.