Class PersonalizationData.Builder
- java.lang.Object
-
- com.android.identity.PersonalizationData.Builder
-
- Enclosing class:
- PersonalizationData
public static final class PersonalizationData.Builder extends java.lang.Object
A builder forPersonalizationData
.
-
-
Constructor Summary
Constructors Constructor Description Builder()
Creates a new builder for a given namespace.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description PersonalizationData.Builder
addAccessControlProfile(AccessControlProfile profile)
Adds a new access control profile to the builder.PersonalizationData
build()
Creates a newPersonalizationData
with all the entries added to the builder.PersonalizationData.Builder
putEntry(java.lang.String namespace, java.lang.String name, java.util.Collection<AccessControlProfileId> accessControlProfileIds, byte[] value)
Adds a new entry to the builder.PersonalizationData.Builder
putEntryBoolean(java.lang.String namespace, java.lang.String name, java.util.Collection<AccessControlProfileId> accessControlProfileIds, boolean value)
Adds a new entry to the builder.PersonalizationData.Builder
putEntryBytestring(java.lang.String namespace, java.lang.String name, java.util.Collection<AccessControlProfileId> accessControlProfileIds, byte[] value)
Adds a new entry to the builder.PersonalizationData.Builder
putEntryCalendar(java.lang.String namespace, java.lang.String name, java.util.Collection<AccessControlProfileId> accessControlProfileIds, android.icu.util.Calendar value)
Adds a new entry to the builder.PersonalizationData.Builder
putEntryInteger(java.lang.String namespace, java.lang.String name, java.util.Collection<AccessControlProfileId> accessControlProfileIds, long value)
Adds a new entry to the builder.PersonalizationData.Builder
putEntryString(java.lang.String namespace, java.lang.String name, java.util.Collection<AccessControlProfileId> accessControlProfileIds, java.lang.String value)
Adds a new entry to the builder.
-
-
-
Method Detail
-
putEntry
@NonNull public PersonalizationData.Builder putEntry(@NonNull java.lang.String namespace, @NonNull java.lang.String name, @NonNull java.util.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(String, String, Collection, String)
orputEntryInteger(String, String, Collection, long)
which accept normal Java data types.- Parameters:
namespace
- The namespace to use, e.g.org.iso.18013-5.2019
.name
- The name of the entry, e.g.height
.accessControlProfileIds
- A set of access control profiles to use.value
- The value to add, in CBOR encoding.- Returns:
- The builder.
-
putEntryString
@NonNull public PersonalizationData.Builder putEntryString(@NonNull java.lang.String namespace, @NonNull java.lang.String name, @NonNull java.util.Collection<AccessControlProfileId> accessControlProfileIds, @NonNull java.lang.String value)
Adds a new entry to the builder.This is a convenience method which encodes
value
as CBOR and adds the resulting bytes usingputEntry(String, String, Collection, byte[])
. The resulting CBOR will be major type 3 (text string).- Parameters:
namespace
- The namespace to use, e.g.org.iso.18013-5.2019
.name
- The name of the entry, e.g.height
.accessControlProfileIds
- A set of access control profiles to use.value
- The value to add.- Returns:
- The builder.
-
putEntryBytestring
@NonNull public PersonalizationData.Builder putEntryBytestring(@NonNull java.lang.String namespace, @NonNull java.lang.String name, @NonNull java.util.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 usingputEntry(String, String, Collection, byte[])
. The resulting CBOR will be major type 2 (bytestring).- Parameters:
namespace
- The namespace to use, e.g.org.iso.18013-5.2019
.name
- The name of the entry, e.g.height
.accessControlProfileIds
- A set of access control profiles to use.value
- The value to add.- Returns:
- The builder.
-
putEntryInteger
@NonNull public PersonalizationData.Builder putEntryInteger(@NonNull java.lang.String namespace, @NonNull java.lang.String name, @NonNull java.util.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 usingputEntry(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
- The namespace to use, e.g.org.iso.18013-5.2019
.name
- The name of the entry, e.g.height
.accessControlProfileIds
- A set of access control profiles to use.value
- The value to add.- Returns:
- The builder.
-
putEntryBoolean
@NonNull public PersonalizationData.Builder putEntryBoolean(@NonNull java.lang.String namespace, @NonNull java.lang.String name, @NonNull java.util.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 usingputEntry(String, String, Collection, byte[])
. The resulting CBOR will be major type 7 (simple value) with additional information 20 (for the valuefalse
) or 21 (for the valuetrue
).- Parameters:
namespace
- The namespace to use, e.g.org.iso.18013-5.2019
.name
- The name of the entry, e.g.height
.accessControlProfileIds
- A set of access control profiles to use.value
- The value to add.- Returns:
- The builder.
-
putEntryCalendar
@NonNull public PersonalizationData.Builder putEntryCalendar(@NonNull java.lang.String namespace, @NonNull java.lang.String name, @NonNull java.util.Collection<AccessControlProfileId> accessControlProfileIds, @NonNull android.icu.util.Calendar value)
Adds a new entry to the builder.This is a convenience method which encodes
value
as CBOR and adds the resulting bytes usingputEntry(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
- The namespace to use, e.g.org.iso.18013-5.2019
.name
- The name of the entry, e.g.height
.accessControlProfileIds
- A set of access control profiles to use.value
- The value to add.- Returns:
- The builder.
-
addAccessControlProfile
@NonNull public PersonalizationData.Builder addAccessControlProfile(@NonNull AccessControlProfile profile)
Adds a new access control profile to the builder.- Parameters:
profile
- The access control profile.- Returns:
- The builder.
-
build
@NonNull public PersonalizationData build()
Creates a newPersonalizationData
with all the entries added to the builder.- Returns:
- A new
PersonalizationData
instance.
-
-