PersonalizationData.Builder


public final class PersonalizationData.Builder


A builder for PersonalizationData.

Summary

Public constructors

Creates a new builder for a given namespace.

Public methods

@NonNull PersonalizationData.Builder

Adds a new access control profile to the builder.

@NonNull PersonalizationData

Creates a new PersonalizationData with all the entries added to the builder.

@NonNull PersonalizationData.Builder
putEntry(
    @NonNull String namespace,
    @NonNull String name,
    @NonNull Collection<AccessControlProfileId> accessControlProfileIds,
    @NonNull byte[] value
)

Adds a new entry to the builder.

@NonNull PersonalizationData.Builder
putEntryBoolean(
    @NonNull String namespace,
    @NonNull String name,
    @NonNull Collection<AccessControlProfileId> accessControlProfileIds,
    boolean value
)

Adds a new entry to the builder.

@NonNull PersonalizationData.Builder
putEntryBytestring(
    @NonNull String namespace,
    @NonNull String name,
    @NonNull Collection<AccessControlProfileId> accessControlProfileIds,
    @NonNull byte[] value
)

Adds a new entry to the builder.

@NonNull PersonalizationData.Builder
putEntryCalendar(
    @NonNull String namespace,
    @NonNull String name,
    @NonNull Collection<AccessControlProfileId> accessControlProfileIds,
    @NonNull Calendar value
)

Adds a new entry to the builder.

@NonNull PersonalizationData.Builder
putEntryInteger(
    @NonNull String namespace,
    @NonNull String name,
    @NonNull Collection<AccessControlProfileId> accessControlProfileIds,
    long value
)

Adds a new entry to the builder.

@NonNull PersonalizationData.Builder
putEntryString(
    @NonNull String namespace,
    @NonNull String name,
    @NonNull Collection<AccessControlProfileId> accessControlProfileIds,
    @NonNull String value
)

Adds a new entry to the builder.

Public constructors

Builder

Added in 1.0.0-alpha04
public Builder()

Creates a new builder for a given namespace.

Public methods

addAccessControlProfile

Added in 1.0.0-alpha04
public @NonNull PersonalizationData.Builder addAccessControlProfile(@NonNull AccessControlProfile profile)

Adds a new access control profile to the builder.

Parameters
@NonNull AccessControlProfile profile

The access control profile.

Returns
@NonNull PersonalizationData.Builder

The builder.

build

Added in 1.0.0-alpha04
public @NonNull PersonalizationData build()

Creates a new PersonalizationData with all the entries added to the builder.

putEntry

Added in 1.0.0-alpha04
public @NonNull PersonalizationData.Builder putEntry(
    @NonNull String namespace,
    @NonNull String name,
    @NonNull Collection<AccessControlProfileId> accessControlProfileIds,
    @NonNull byte[] value
)

Adds a new entry to the builder.

This is a low-level method which expects the data to be the bytes of a CBOR value. When possible, applications should use methods such as putEntryString or putEntryInteger which accept normal Java data types.

Parameters
@NonNull String namespace

The namespace to use, e.g. org.iso.18013-5.2019.

@NonNull String name

The name of the entry, e.g. height.

@NonNull Collection<AccessControlProfileId> accessControlProfileIds

A set of access control profiles to use.

@NonNull byte[] value

The value to add, in CBOR encoding.

Returns
@NonNull PersonalizationData.Builder

The builder.

putEntryBoolean

Added in 1.0.0-alpha04
public @NonNull PersonalizationData.Builder putEntryBoolean(
    @NonNull String namespace,
    @NonNull String name,
    @NonNull Collection<AccessControlProfileId> accessControlProfileIds,
    boolean value
)

Adds a new entry to the builder.

This is a convenience method which encodes value as CBOR and adds the resulting bytes using putEntry. The resulting CBOR will be major type 7 (simple value) with additional information 20 (for the value false) or 21 (for the value true).

Parameters
@NonNull String namespace

The namespace to use, e.g. org.iso.18013-5.2019.

@NonNull String name

The name of the entry, e.g. height.

@NonNull Collection<AccessControlProfileId> accessControlProfileIds

A set of access control profiles to use.

boolean value

The value to add.

Returns
@NonNull PersonalizationData.Builder

The builder.

putEntryBytestring

Added in 1.0.0-alpha04
public @NonNull PersonalizationData.Builder putEntryBytestring(
    @NonNull String namespace,
    @NonNull String name,
    @NonNull Collection<AccessControlProfileId> accessControlProfileIds,
    @NonNull byte[] value
)

Adds a new entry to the builder.

This is a convenience method which encodes value as CBOR and adds the resulting bytes using putEntry. The resulting CBOR will be major type 2 (bytestring).

Parameters
@NonNull String namespace

The namespace to use, e.g. org.iso.18013-5.2019.

@NonNull String name

The name of the entry, e.g. height.

@NonNull Collection<AccessControlProfileId> accessControlProfileIds

A set of access control profiles to use.

@NonNull byte[] value

The value to add.

Returns
@NonNull PersonalizationData.Builder

The builder.

putEntryCalendar

Added in 1.0.0-alpha04
public @NonNull PersonalizationData.Builder putEntryCalendar(
    @NonNull String namespace,
    @NonNull String name,
    @NonNull Collection<AccessControlProfileId> accessControlProfileIds,
    @NonNull Calendar value
)

Adds a new entry to the builder.

This is a convenience method which encodes value as CBOR and adds the resulting bytes using putEntry. The resulting CBOR will be a tagged string with tag 0 as per Section 2.4.1 of RFC 7049. This means that the tagged string follows the standard format described in RFC 3339, as refined by Section 3.3 of RFC 4287>.

Parameters
@NonNull String namespace

The namespace to use, e.g. org.iso.18013-5.2019.

@NonNull String name

The name of the entry, e.g. height.

@NonNull Collection<AccessControlProfileId> accessControlProfileIds

A set of access control profiles to use.

@NonNull Calendar value

The value to add.

Returns
@NonNull PersonalizationData.Builder

The builder.

putEntryInteger

Added in 1.0.0-alpha04
public @NonNull PersonalizationData.Builder putEntryInteger(
    @NonNull String namespace,
    @NonNull String name,
    @NonNull Collection<AccessControlProfileId> accessControlProfileIds,
    long value
)

Adds a new entry to the builder.

This is a convenience method which encodes value as CBOR and adds the resulting bytes using putEntry. The resulting CBOR will be major type 0 (unsigned integer) if non-negative, otherwise major type 1 (negative integer).

Parameters
@NonNull String namespace

The namespace to use, e.g. org.iso.18013-5.2019.

@NonNull String name

The name of the entry, e.g. height.

@NonNull Collection<AccessControlProfileId> accessControlProfileIds

A set of access control profiles to use.

long value

The value to add.

Returns
@NonNull PersonalizationData.Builder

The builder.

putEntryString

Added in 1.0.0-alpha04
public @NonNull PersonalizationData.Builder putEntryString(
    @NonNull String namespace,
    @NonNull String name,
    @NonNull Collection<AccessControlProfileId> accessControlProfileIds,
    @NonNull String value
)

Adds a new entry to the builder.

This is a convenience method which encodes value as CBOR and adds the resulting bytes using putEntry. The resulting CBOR will be major type 3 (text string).

Parameters
@NonNull String namespace

The namespace to use, e.g. org.iso.18013-5.2019.

@NonNull String name

The name of the entry, e.g. height.

@NonNull Collection<AccessControlProfileId> accessControlProfileIds

A set of access control profiles to use.

@NonNull String value

The value to add.

Returns
@NonNull PersonalizationData.Builder

The builder.