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 -
Method Summary
Modifier and TypeMethodDescriptionClass<?>
Gets the class that this validator supports.boolean
supports
(com.broadleafcommerce.order.common.domain.Address address) Tells if this validator supports the given fulfillment group address.protected boolean
useFullName
(@NonNull Set<Object> hints) Tells if the full name or the individual first and last name should be used for validation.void
validate
(@NonNull Object target, @NonNull org.springframework.validation.Errors errors, @NonNull Set<Object> validationHints) Validates the target.protected void
validateAddress
(@NonNull com.broadleafcommerce.order.common.domain.Address address, @NonNull org.springframework.validation.Errors errors, @NonNull Set<Object> hints) Validates the address.protected void
validateAddressLine1
(@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 void
validateCity
(@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 void
validateCompanyName
(@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 void
validateCountry
(@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 void
validateCounty
(@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 void
validateEmailAddress
(@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 void
validateName
(@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 void
validatePhonePrimary
(@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 void
validatePostalCode
(@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 void
validateStateProvinceRegionSubdivision
(@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
Methods inherited from interface com.broadleafcommerce.cartoperation.service.fulfillment.validation.FulfillmentValidator
supports, validate, validate, validate, validate
Methods inherited from interface org.springframework.validation.SmartValidator
validateValue
-
Constructor Details
-
DefaultFulfillmentAddressSubmitValidator
public DefaultFulfillmentAddressSubmitValidator()
-
-
Method Details
-
supports
public boolean supports(com.broadleafcommerce.order.common.domain.Address address) Description copied from interface:FulfillmentAddressSubmitValidator
Tells if this validator supports the given fulfillment group address.- Specified by:
supports
in interfaceFulfillmentAddressSubmitValidator
- Parameters:
address
- the fulfillment group address to test support of- Returns:
- true if this supports validation of the given address, false otherwise
-
getSupportedClass
Description copied from interface:FulfillmentValidator
Gets the class that this validator supports.- Specified by:
getSupportedClass
in 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:FulfillmentValidator
Validates the target.- Specified by:
validate
in 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
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
-