Class AbstractTypeFulfillmentGroupSubmitValidator
- java.lang.Object
-
- com.broadleafcommerce.cartoperation.service.fulfillment.validation.type.AbstractTypeFulfillmentGroupSubmitValidator
-
- All Implemented Interfaces:
FulfillmentValidator
,TypeFulfillmentGroupSubmitValidator
,org.springframework.validation.SmartValidator
,org.springframework.validation.Validator
- Direct Known Subclasses:
PickupTypeFulfillmentGroupSubmitValidator
,ShipTypeFulfillmentGroupSubmitValidator
,VirtualTypeFulfillmentGroupSubmitValidator
public abstract class AbstractTypeFulfillmentGroupSubmitValidator extends Object implements TypeFulfillmentGroupSubmitValidator
Holds common logic for validating different fulfillment types (address validation).- Author:
- Jacob Mitash
-
-
Field Summary
-
Fields inherited from interface com.broadleafcommerce.cartoperation.service.fulfillment.validation.type.TypeFulfillmentGroupSubmitValidator
HINT_FORCE_ADDRESS_VALIDATION, HINT_SKIP_ADDRESS_VALIDATION
-
-
Constructor Summary
Constructors Constructor Description AbstractTypeFulfillmentGroupSubmitValidator(Set<FulfillmentAddressSubmitValidator> addressValidators)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected Set<FulfillmentAddressSubmitValidator>
getAddressValidators()
protected abstract boolean
shouldValidateAddress(Set<Object> hints)
Tells whether this validator should validate the address or not.void
validate(@NonNull Object target, @NonNull org.springframework.validation.Errors errors, @NonNull Set<Object> validationHints)
Validates the target.protected void
validateAddress(@NonNull com.broadleafcommerce.cart.client.domain.FulfillmentGroup group, @NonNull org.springframework.validation.Errors errors, @NonNull Set<Object> hints)
Validates the address (if required byshouldValidateAddress(Set)
).-
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
getSupportedClass, supports, validate, validate, validate, validate
-
Methods inherited from interface com.broadleafcommerce.cartoperation.service.fulfillment.validation.type.TypeFulfillmentGroupSubmitValidator
supports
-
-
-
-
Constructor Detail
-
AbstractTypeFulfillmentGroupSubmitValidator
public AbstractTypeFulfillmentGroupSubmitValidator(Set<FulfillmentAddressSubmitValidator> addressValidators)
-
-
Method Detail
-
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
-
shouldValidateAddress
protected abstract boolean shouldValidateAddress(Set<Object> hints)
Tells whether this validator should validate the address or not.- Parameters:
hints
- hints to use when determining whether or not to validate the address- Returns:
- true to validate the address, false otherwise
-
validateAddress
protected void validateAddress(@NonNull @NonNull com.broadleafcommerce.cart.client.domain.FulfillmentGroup group, @NonNull @NonNull org.springframework.validation.Errors errors, @NonNull @NonNull Set<Object> hints)
Validates the address (if required byshouldValidateAddress(Set)
).- Parameters:
group
- the fulfillment group of which to validate the addresserrors
- error container to place validation errors inhints
- any hints to use during validation
-
getAddressValidators
protected Set<FulfillmentAddressSubmitValidator> getAddressValidators()
-
-