setAttribute

fun setAttribute(@Size(min = 1) attribute: String, @Size(min = 1, max = 1024) string: String): AttributeEditor

Sets a string attribute.

Return

The AttributeEditor.

Parameters

attribute

The attribute. Must be greater must be greater than 1 character and not contain #.

string

The attribute string. It must be greater than 1 character and less than 1024 characters in length.

Throws

if:

  • The key is empty or contains #.

  • The string is empty or greater than 1024 characters in length.


fun setAttribute(@Size(min = 1) attribute: String, number: Int): AttributeEditor

Sets an integer number attribute.

Return

The AttributeEditor.

Parameters

attribute

The attribute. Must be greater must be greater than 1 character and not contain #.

number

The number attribute.

Throws

if:

  • The key is empty or contains #.


fun setAttribute(@Size(min = 1) attribute: String, number: Long): AttributeEditor

Sets a long number attribute.

Return

The AttributeEditor.

Parameters

attribute

The attribute. Must be greater must be greater than 1 character and not contain #.

number

The number attribute.

Throws

if:

  • The key is empty or contains #.


fun setAttribute(@Size(min = 1) attribute: String, number: Float): AttributeEditor

Sets a float number attribute.

Return

The AttributeEditor.

Parameters

attribute

The attribute. Must be greater must be greater than 1 character and not contain #.

number

The number attribute.

Throws

if:

  • The key is empty or contains #.

if:

  • The number is NaN or infinite.


fun setAttribute(@Size(min = 1) attribute: String, number: Double): AttributeEditor

Sets a double number attribute.

Return

The AttributeEditor.

Parameters

attribute

The attribute. Must be greater must be greater than 1 character and not contain #.

number

The number attribute.

Throws

if:

  • The key is empty or contains #.

if:

  • The number is NaN or infinite.


fun setAttribute(@Size(min = 1) attribute: String, date: Date): AttributeEditor

Sets a date attribute.

Return

The AttributeEditor.

Parameters

attribute

The attribute. Must be greater must be greater than 1 character and not contain #.

date

The date attribute.

Throws

if:

  • The key is empty or contains #.


fun setAttribute(@Size(min = 1) attribute: String, @Size(min = 1) instanceId: String, expiration: Date? = null, json: JsonMap): AttributeEditor

Sets a custom attribute with a JSON payload and optional expiration.

Return

The AttributeEditor.

Parameters

attribute

The attribute.

instanceId

The instance identifier.

json

A JsonMap representing the custom payload.

Throws

if:

  • The key is empty or contains #.

  • The expiration is invalid (in the past or 731 days from now.

  • The payload is empty or contains a reserved key exp.