Status.Builder

class Status.Builder


Helper to Build OngoingActivityStatus instances. Templates can be specified, to specify how to render the parts and any surrounding text/format. If no template is specified, a default template that concatenates all parts separated by space is used.

Summary

Public constructors

Public functions

Status.Builder
addPart(name: String, part: Status.Part)

Add a part to be inserted in the placeholders.

Status.Builder

Add a template to use for this status.

Status

Build an OngoingActivityStatus with the given parameters.

Public constructors

Builder

Added in 1.0.0
Builder()

Public functions

addPart

Added in 1.0.0
fun addPart(name: String, part: Status.Part): Status.Builder

Add a part to be inserted in the placeholders.

Parameters
name: String

the name of this part. In the template, use this name surrounded by '#' to reference it, e.g. here "track" and in the template "#track#"

part: Status.Part

The part that will be rendered in the specified position/s in the template.

Returns
Status.Builder

this builder, to chain calls.

addTemplate

Added in 1.0.0
fun addTemplate(template: CharSequence): Status.Builder

Add a template to use for this status. Placeholders can be defined with #name# To produce a '#', use '##' in the template. If multiple templates are specified, the first one (in the order they where added by calling this method) that has all required fields is used. If no template is specified, a default template that concatenates all parts separated by space is used.

Parameters
template: CharSequence

the template to be added

Returns
Status.Builder

this builder, to chain calls.

build

Added in 1.0.0
fun build(): Status

Build an OngoingActivityStatus with the given parameters.

Returns
Status

the built OngoingActivityStatus