com.yoti.api.client.identity.extension.ThirdPartyAttributeExtensionBuilder Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of yoti-sdk-api Show documentation
Show all versions of yoti-sdk-api Show documentation
Java SDK for simple integration with the Yoti platform
The newest version!
package com.yoti.api.client.identity.extension;
import java.time.OffsetDateTime;
import java.util.ArrayList;
import java.util.List;
import com.yoti.api.client.AttributeDefinition;
import com.yoti.validation.Validation;
public class ThirdPartyAttributeExtensionBuilder implements ExtensionBuilder {
private OffsetDateTime expiryDate;
private List definitions;
public ThirdPartyAttributeExtensionBuilder() {
this.definitions = new ArrayList<>();
}
public ThirdPartyAttributeExtensionBuilder withExpiryDate(OffsetDateTime expiryDate) {
Validation.notNull(expiryDate, Property.EXPIRY_DATE);
this.expiryDate = expiryDate;
return this;
}
public ThirdPartyAttributeExtensionBuilder withDefinition(String definition) {
Validation.notNullOrEmpty(definition, Property.DEFINITION);
this.definitions.add(new AttributeDefinition(definition));
return this;
}
public ThirdPartyAttributeExtensionBuilder withDefinitions(List definitions) {
List attributeDefinitions = new ArrayList<>();
for (String definition : definitions) {
attributeDefinitions.add(new AttributeDefinition(definition));
}
this.definitions = attributeDefinitions;
return this;
}
public Extension build() {
ThirdPartyAttributeContent thirdPartyAttributeContent = new ThirdPartyAttributeContent(expiryDate, definitions);
return new Extension<>("THIRD_PARTY_ATTRIBUTE", thirdPartyAttributeContent);
}
private static final class Property {
private static final String EXPIRY_DATE = "expiry_date";
private static final String DEFINITION = "definition";
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy