Class PersonalizationData.Builder

    • Constructor Detail

      • Builder

        public Builder()
        Creates a new builder for a given namespace.
    • 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) or putEntryInteger(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 using putEntry(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 using putEntry(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 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 - 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 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 - 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 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 - 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.