pingidentity / scim2

The UnboundID SCIM 2.0 SDK for Java
181 stars 74 forks source link

Add varargs helper methods for multi-valued fields #191

Closed kqarryzada closed 1 year ago

kqarryzada commented 1 year ago

The SDK has many methods where an attribute can be set to multiple values (e.g., setEmails() on UserResource allows a user to have multiple emails). These methods typically take in an attribute name and a list of values. There is sometimes some friction with always requiring a list, however. For example, if a Patch request should have a single patch operation, then the operation must be wrapped in a Collections.singletonList() call, which can be clunky.

To remedy this, new methods have been added that allow passing in the values directly into a method without requiring the caller to wrap the values in a list first. This is done by adding some overloaded methods that accept a varargs parameter, and perform the list conversion for the caller.

These methods always require a single non-null value to avoid breaking backward compatibility for calls like 'new UserResource().setEmails(null)'.

JiraIssue: DS-47088