Class DefaultFulfillmentAddressSubmitValidator
- java.lang.Object
-
- com.broadleafcommerce.cartoperation.service.fulfillment.validation.address.DefaultFulfillmentAddressSubmitValidator
-
- All Implemented Interfaces:
FulfillmentAddressSubmitValidator,FulfillmentValidator,org.springframework.validation.SmartValidator,org.springframework.validation.Validator
public class DefaultFulfillmentAddressSubmitValidator extends Object implements FulfillmentAddressSubmitValidator
Performs basic validation of the address of a fulfillment group to ensure required fields are present.- Author:
- Jacob Mitash
-
-
Field Summary
-
Fields inherited from interface com.broadleafcommerce.cartoperation.service.fulfillment.validation.address.FulfillmentAddressSubmitValidator
HINT_CITY_NOT_REQUIRED, HINT_COMPANY_NAME_REQUIRED, HINT_COUNTRY_NOT_REQUIRED, HINT_COUNTY_REQUIRED, HINT_EMAIL_REQUIRED, HINT_PHONE_PRIMARY_NOT_REQUIRED, HINT_POSTAL_CODE_NOT_REQUIRED, HINT_STATE_PROVINCE_REGION_NOT_REQUIRED, HINT_VALIDATE_FIRST_AND_LAST
-
-
Constructor Summary
Constructors Constructor Description DefaultFulfillmentAddressSubmitValidator()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Class<?>getSupportedClass()Gets the class that this validator supports.booleansupports(com.broadleafcommerce.order.common.domain.Address address)Tells if this validator supports the given fulfillment group address.protected booleanuseFullName(@NonNull Set<Object> hints)Tells if the full name or the individual first and last name should be used for validation.voidvalidate(@NonNull Object target, @NonNull org.springframework.validation.Errors errors, @NonNull Set<Object> validationHints)Validates the target.protected voidvalidateAddress(@NonNull com.broadleafcommerce.order.common.domain.Address address, @NonNull org.springframework.validation.Errors errors, @NonNull Set<Object> hints)Validates the address.protected voidvalidateAddressLine1(@NonNull com.broadleafcommerce.order.common.domain.Address address, @NonNull org.springframework.validation.Errors errors, @NonNull Set<Object> hints)Validates the address line 1 on the address.protected voidvalidateCity(@NonNull com.broadleafcommerce.order.common.domain.Address address, @NonNull org.springframework.validation.Errors errors, @NonNull Set<Object> hints)Validates the city on the address.protected voidvalidateCompanyName(@NonNull com.broadleafcommerce.order.common.domain.Address address, @NonNull org.springframework.validation.Errors errors, @NonNull Set<Object> hints)Validates the company name on the address.protected voidvalidateCountry(@NonNull com.broadleafcommerce.order.common.domain.Address address, @NonNull org.springframework.validation.Errors errors, @NonNull Set<Object> hints)Validates the country on the address.protected voidvalidateCounty(@NonNull com.broadleafcommerce.order.common.domain.Address address, @NonNull org.springframework.validation.Errors errors, @NonNull Set<Object> hints)Validates the county on the address.protected voidvalidateEmailAddress(@NonNull com.broadleafcommerce.order.common.domain.Address address, @NonNull org.springframework.validation.Errors errors, @NonNull Set<Object> hints)Validates the email address on the address.protected voidvalidateName(@NonNull com.broadleafcommerce.order.common.domain.Address address, @NonNull org.springframework.validation.Errors errors, @NonNull Set<Object> hints)Validates the name on the address.protected voidvalidatePhonePrimary(@NonNull com.broadleafcommerce.order.common.domain.Address address, @NonNull org.springframework.validation.Errors errors, @NonNull Set<Object> hints)Validates the primary phone number on the address.protected voidvalidatePostalCode(@NonNull com.broadleafcommerce.order.common.domain.Address address, @NonNull org.springframework.validation.Errors errors, @NonNull Set<Object> hints)Validates the postal code on the address.protected voidvalidateStateProvinceRegionSubdivision(@NonNull com.broadleafcommerce.order.common.domain.Address address, @NonNull org.springframework.validation.Errors errors, @NonNull Set<Object> hints)Validates the state province region on the address.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
-
-
-
Method Detail
-
supports
public boolean supports(com.broadleafcommerce.order.common.domain.Address address)
Description copied from interface:FulfillmentAddressSubmitValidatorTells if this validator supports the given fulfillment group address.- Specified by:
supportsin interfaceFulfillmentAddressSubmitValidator- Parameters:
address- the fulfillment group address to test support of- Returns:
- true if this supports validation of the given address, false otherwise
-
getSupportedClass
public Class<?> getSupportedClass()
Description copied from interface:FulfillmentValidatorGets the class that this validator supports.- Specified by:
getSupportedClassin interfaceFulfillmentValidator- Returns:
- the class that this validator support
-
validate
public void validate(@NonNull @NonNull Object target, @NonNull @NonNull org.springframework.validation.Errors errors, @NonNull @NonNull Set<Object> validationHints)Description copied from interface:FulfillmentValidatorValidates the target.- Specified by:
validatein interfaceFulfillmentValidator- Parameters:
target- the target of the validationerrors- an errors container to place rejections and pull values fromvalidationHints- any hints that should be used during validation
-
validateAddress
protected void validateAddress(@NonNull @NonNull com.broadleafcommerce.order.common.domain.Address address, @NonNull @NonNull org.springframework.validation.Errors errors, @NonNull @NonNull Set<Object> hints)Validates the address.- Parameters:
address- the address to validateerrors- an errors container to place rejections and pull values fromhints- any hints that should be used during the validation
-
validateName
protected void validateName(@NonNull @NonNull com.broadleafcommerce.order.common.domain.Address address, @NonNull @NonNull org.springframework.validation.Errors errors, @NonNull @NonNull Set<Object> hints)Validates the name on the address.- Parameters:
address- the address to validateerrors- an errors container to place rejections and pull values fromhints- any hints that should be used during the validation
-
validateEmailAddress
protected void validateEmailAddress(@NonNull @NonNull com.broadleafcommerce.order.common.domain.Address address, @NonNull @NonNull org.springframework.validation.Errors errors, @NonNull @NonNull Set<Object> hints)Validates the email address on the address.- Parameters:
address- the address to validateerrors- an errors container to place rejections and pull values fromhints- any hints that should be used during the validation
-
validateCompanyName
protected void validateCompanyName(@NonNull @NonNull com.broadleafcommerce.order.common.domain.Address address, @NonNull @NonNull org.springframework.validation.Errors errors, @NonNull @NonNull Set<Object> hints)Validates the company name on the address.- Parameters:
address- the address to validateerrors- an errors container to place rejections and pull values fromhints- any hints that should be used during the validation
-
validateAddressLine1
protected void validateAddressLine1(@NonNull @NonNull com.broadleafcommerce.order.common.domain.Address address, @NonNull @NonNull org.springframework.validation.Errors errors, @NonNull @NonNull Set<Object> hints)Validates the address line 1 on the address.- Parameters:
address- the address to validateerrors- an errors container to place rejections and pull values fromhints- any hints that should be used during the validation
-
validateCity
protected void validateCity(@NonNull @NonNull com.broadleafcommerce.order.common.domain.Address address, @NonNull @NonNull org.springframework.validation.Errors errors, @NonNull @NonNull Set<Object> hints)Validates the city on the address.- Parameters:
address- the address to validateerrors- an errors container to place rejections and pull values fromhints- any hints that should be used during the validation
-
validateCounty
protected void validateCounty(@NonNull @NonNull com.broadleafcommerce.order.common.domain.Address address, @NonNull @NonNull org.springframework.validation.Errors errors, @NonNull @NonNull Set<Object> hints)Validates the county on the address.- Parameters:
address- the address to validateerrors- an errors container to place rejections and pull values fromhints- any hints that should be used during the validation
-
validateCountry
protected void validateCountry(@NonNull @NonNull com.broadleafcommerce.order.common.domain.Address address, @NonNull @NonNull org.springframework.validation.Errors errors, @NonNull @NonNull Set<Object> hints)Validates the country on the address.- Parameters:
address- the address to validateerrors- an errors container to place rejections and pull values fromhints- any hints that should be used during the validation
-
validateStateProvinceRegionSubdivision
protected void validateStateProvinceRegionSubdivision(@NonNull @NonNull com.broadleafcommerce.order.common.domain.Address address, @NonNull @NonNull org.springframework.validation.Errors errors, @NonNull @NonNull Set<Object> hints)Validates the state province region on the address.- Parameters:
address- the address to validateerrors- an errors container to place rejections and pull values fromhints- any hints that should be used during the validation
-
validatePostalCode
protected void validatePostalCode(@NonNull @NonNull com.broadleafcommerce.order.common.domain.Address address, @NonNull @NonNull org.springframework.validation.Errors errors, @NonNull @NonNull Set<Object> hints)Validates the postal code on the address.- Parameters:
address- the address to validateerrors- an errors container to place rejections and pull values fromhints- any hints that should be used during the validation
-
validatePhonePrimary
protected void validatePhonePrimary(@NonNull @NonNull com.broadleafcommerce.order.common.domain.Address address, @NonNull @NonNull org.springframework.validation.Errors errors, @NonNull @NonNull Set<Object> hints)Validates the primary phone number on the address.- Parameters:
address- the address to validateerrors- an errors container to place rejections and pull values fromhints- any hints that should be used during the validation
-
useFullName
protected boolean useFullName(@NonNull @NonNull Set<Object> hints)Tells if the full name or the individual first and last name should be used for validation.- Parameters:
hints- any hints to take into account when deciding which name type should be validated- Returns:
- true if validation should use the full name, false if validation should use the first and last
-
-