Google is committed to advancing racial equity for Black communities. See how.

PersonalizationData.Builder

public static final class PersonalizationData.Builder
extends Object

java.lang.Object
   ↳ androidx.security.identity.PersonalizationData.Builder


A builder for PersonalizationData.

Summary

Public constructors

Builder()

Creates a new builder for a given namespace.

Public methods

PersonalizationData.Builder addAccessControlProfile(AccessControlProfile profile)

Adds a new access control profile to the builder.

PersonalizationData build()

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

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

Adds a new entry to the builder.

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

Adds a new entry to the builder.

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

Adds a new entry to the builder.

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

Adds a new entry to the builder.

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

Adds a new entry to the builder.

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

Adds a new entry to the builder.

Inherited methods

Public constructors

Builder

public Builder ()

Creates a new builder for a given namespace.

Public methods

addAccessControlProfile

public PersonalizationData.Builder addAccessControlProfile (AccessControlProfile profile)

Adds a new access control profile to the builder.

Parameters
profile AccessControlProfile: The access control profile.

Returns
PersonalizationData.Builder The builder.

build

public PersonalizationData build ()

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

Returns
PersonalizationData A new PersonalizationData instance.

putEntry

public PersonalizationData.Builder putEntry (String namespace, 
                String name, 
                Collection<AccessControlProfileId> accessControlProfileIds, 
                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(String, String, Collection, String) or putEntryInteger(String, String, Collection, long) which accept normal Java data types.

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

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

accessControlProfileIds Collection: A set of access control profiles to use.

value byte: The value to add, in CBOR encoding.

Returns
PersonalizationData.Builder The builder.

putEntryBoolean

public PersonalizationData.Builder putEntryBoolean (String namespace, 
                String name, 
                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(String, String, Collection, byte[]). 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
namespace String: The namespace to use, e.g. org.iso.18013-5.2019.

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

accessControlProfileIds Collection: A set of access control profiles to use.

value boolean: The value to add.

Returns
PersonalizationData.Builder The builder.

putEntryBytestring

public PersonalizationData.Builder putEntryBytestring (String namespace, 
                String name, 
                Collection<AccessControlProfileId> accessControlProfileIds, 
                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(String, String, Collection, byte[]). The resulting CBOR will be major type 2 (bytestring).

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

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

accessControlProfileIds Collection: A set of access control profiles to use.

value byte: The value to add.

Returns
PersonalizationData.Builder The builder.

putEntryCalendar

public PersonalizationData.Builder putEntryCalendar (String namespace, 
                String name, 
                Collection<AccessControlProfileId> accessControlProfileIds, 
                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(String, String, Collection, byte[]). 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
namespace String: The namespace to use, e.g. org.iso.18013-5.2019.

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

accessControlProfileIds Collection: A set of access control profiles to use.

value Calendar: The value to add.

Returns
PersonalizationData.Builder The builder.

putEntryInteger

public PersonalizationData.Builder putEntryInteger (String namespace, 
                String name, 
                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(String, String, Collection, byte[]). The resulting CBOR will be major type 0 (unsigned integer) if non-negative, otherwise major type 1 (negative integer).

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

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

accessControlProfileIds Collection: A set of access control profiles to use.

value long: The value to add.

Returns
PersonalizationData.Builder The builder.

putEntryString

public PersonalizationData.Builder putEntryString (String namespace, 
                String name, 
                Collection<AccessControlProfileId> accessControlProfileIds, 
                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(String, String, Collection, byte[]). The resulting CBOR will be major type 3 (text string).

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

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

accessControlProfileIds Collection: A set of access control profiles to use.

value String: The value to add.

Returns
PersonalizationData.Builder The builder.