Interface AddressValidationService

All Superinterfaces:
Service

public interface AddressValidationService
extends Service
AddressValidationService is used to acquire a AddressValidator based on its fully qualified class name or alias. The AddressValidator can then be used to make a request to the service it depends on to validate a given Address. A typical use case would look something like below:
   AddressValidationService addressService = Services.get(AddressValidationService.class);
   AddressValidator validator = addressService.getValidator(validatorAlias, validationGroupName).orElseThrow( () -> new RuntimeException("Address Validator not found: " + validatorAlias ));
   AddressValidationResult response = validator.validate(address);
   Optional
suggested = response.getSuggestedAddress(); if(suggested.isPresent()) { address = suggested.get(); ... // Do something with suggested Address } else { model.setError(response.getDefaultErrorMessage(locale)); }
  • Method Summary

    Modifier and Type Method Description
    AddressValidator getValidator​(java.lang.String validatorName, java.lang.String validatorGroupKey, PlatformUserProfile profile)
    Returns the validator that matches the given service name.
  • Method Details

    • getValidator

      AddressValidator getValidator​(java.lang.String validatorName, java.lang.String validatorGroupKey, PlatformUserProfile profile)
      Returns the validator that matches the given service name. validatorGroupKey - This parameter identifies which group the call is being made from to determine which API key should be used to initialize the AddressValidator. This key can be Enterprise Name so that all calls from that Enterprise get put on the same API Key or something shared between Enterprises so that all users with that group are on the same Key. If no such service exists or the validatorGroupKey does not match to an API Key returns null