77public class IdentityMapV3Input {
88 /**
99 * @param emails a list of normalized or unnormalized email addresses
10- * @return a IdentityMapV3Input instance, to be used in {@link IdentityMapHelper #createEnvelopeForIdentityMapRequest}
10+ * @return a IdentityMapV3Input instance, to be used in {@link IdentityMapV3Helper #createEnvelopeForIdentityMapRequest}
1111 */
1212 public static IdentityMapV3Input fromEmails (List <String > emails ) {
1313 return new IdentityMapV3Input ().withEmails (emails );
@@ -47,53 +47,85 @@ public static IdentityMapV3Input fromHashedPhones(List<String> hashedPhones) {
4747
4848 public IdentityMapV3Input () {}
4949
50+ /**
51+ * @param hashedEmails a <a href="https://unifiedid.com/docs/getting-started/gs-normalization-encoding#email-address-normalization">normalized</a> and <a href="https://unifiedid.com/docs/getting-started/gs-normalization-encoding#email-address-hash-encoding">hashed</a> email address
52+ * @return this IdentityMapV3Input instance
53+ */
5054 public IdentityMapV3Input withHashedEmails (List <String > hashedEmails ) {
5155 for (String hashedEmail : hashedEmails ) {
5256 withHashedEmail (hashedEmail );
5357 }
5458 return this ;
5559 }
5660
61+ /**
62+ * @param hashedEmail a <a href="https://unifiedid.com/docs/getting-started/gs-normalization-encoding#email-address-normalization">normalized</a> and <a href="https://unifiedid.com/docs/getting-started/gs-normalization-encoding#email-address-hash-encoding">hashed</a> email address
63+ * @return this IdentityMapV3Input instance
64+ */
5765 public IdentityMapV3Input withHashedEmail (String hashedEmail ) {
5866 this .hashedEmails .add (new Identity (hashedEmail ));
5967 addToDiiMappings (hashedEmail , hashedEmail );
6068 return this ;
6169 }
6270
71+ /**
72+ * @param hashedPhones a <a href="https://unifiedid.com/docs/getting-started/gs-normalization-encoding#phone-number-normalization">normalized</a> and <a href="https://unifiedid.com/docs/getting-started/gs-normalization-encoding#phone-number-hash-encoding">hashed</a> phone number
73+ * @return this IdentityMapV3Input instance
74+ */
6375 public IdentityMapV3Input withHashedPhones (List <String > hashedPhones ) {
6476 for (String hashedPhone : hashedPhones ) {
6577 withHashedPhone (hashedPhone );
6678 }
6779 return this ;
6880 }
6981
82+ /**
83+ * @param hashedPhone a <a href="https://unifiedid.com/docs/getting-started/gs-normalization-encoding#phone-number-normalization">normalized</a> and <a href="https://unifiedid.com/docs/getting-started/gs-normalization-encoding#phone-number-hash-encoding">hashed</a> phone number
84+ * @return this IdentityMapV3Input instance
85+ */
7086 public IdentityMapV3Input withHashedPhone (String hashedPhone ) {
7187 this .hashedPhones .add (new Identity (hashedPhone ));
7288 addToDiiMappings (hashedPhone , hashedPhone );
7389 return this ;
7490 }
7591
92+ /**
93+ * @param emails a list of normalized or unnormalized email addresses
94+ * @return this IdentityMapV3Input instance
95+ */
7696 public IdentityMapV3Input withEmails (List <String > emails ) {
7797 for (String email : emails ) {
7898 withEmail (email );
7999 }
80100 return this ;
81101 }
82102
103+ /**
104+ * @param email a normalized or unnormalized email address
105+ * @return this IdentityMapV3Input instance
106+ */
83107 public IdentityMapV3Input withEmail (String email ) {
84108 String hashedEmail = InputUtil .normalizeAndHashEmail (email );
85109 this .hashedEmails .add (new Identity (hashedEmail ));
86110 addToDiiMappings (hashedEmail , email );
87111 return this ;
88112 }
89113
114+ /**
115+ * @param phones a <a href="https://unifiedid.com/docs/getting-started/gs-normalization-encoding#phone-number-normalization">normalized</a> phone number
116+ * @return this IdentityMapV3Input instance
117+ */
90118 public IdentityMapV3Input withPhones (List <String > phones ) {
91119 for (String phone : phones ) {
92120 withPhone (phone );
93121 }
94122 return this ;
95123 }
96124
125+ /**
126+ * @param phone a <a href="https://unifiedid.com/docs/getting-started/gs-normalization-encoding#phone-number-normalization">normalized</a> phone number
127+ * @return this IdentityMapV3Input instance
128+ */
97129 public IdentityMapV3Input withPhone (String phone ) {
98130 if (!InputUtil .isPhoneNumberNormalized (phone )) {
99131 throw new IllegalArgumentException ("phone number is not normalized: " + phone );
@@ -106,14 +138,14 @@ public IdentityMapV3Input withPhone(String phone) {
106138
107139 }
108140
109- private void addToDiiMappings (String hashedDii , String rawDii ) {
110- diiMappings .computeIfAbsent (hashedDii , k -> new ArrayList <>()).add (rawDii );
111- }
112-
113141 List <String > getRawDiis (String identityType , int i ) {
114142 return diiMappings .get (getEncodedDii (identityType , i ));
115143 }
116144
145+ private void addToDiiMappings (String hashedDii , String rawDii ) {
146+ diiMappings .computeIfAbsent (hashedDii , k -> new ArrayList <>()).add (rawDii );
147+ }
148+
117149 private String getEncodedDii (String identityType , int i ) {
118150 switch (identityType ) {
119151 case "email_hash" : return hashedEmails .get (i ).identity ;
0 commit comments