public class EventConstraintDecorator extends java.lang.Object implements InternalEvent
| Constructor and Description |
|---|
EventConstraintDecorator(InternalEvent eventToDecorate,
int maxAttributesAndMetrics) |
| 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) |
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 EventConstraintDecorator |
newInstance(InternalEvent eventToDecorate) |
org.json.JSONObject |
toJSONObject() |
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 EventConstraintDecorator(InternalEvent eventToDecorate, int maxAttributesAndMetrics)
public static EventConstraintDecorator newInstance(InternalEvent eventToDecorate)
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 AnalyticsEvent 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 AnalyticsEvent 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 org.json.JSONObject toJSONObject()
toJSONObject in interface JSONSerializablepublic java.lang.Long getEventTimestamp()
getEventTimestamp in interface InternalEventpublic Id getUniqueId()
getUniqueId in interface InternalEventpublic java.lang.String getSessionId()
getSessionId in interface InternalEventpublic long getSessionStart()
getSessionStart in interface InternalEventpublic java.lang.Long getSessionStop()
getSessionStop in interface InternalEventpublic java.lang.Long getSessionDuration()
getSessionDuration in interface InternalEventpublic java.lang.String getSdkName()
getSdkName in interface InternalEventpublic java.lang.String getSdkVersion()
getSdkVersion in interface InternalEventpublic ClientContext createClientContext(java.lang.String networkType)
createClientContext in interface InternalEvent