Class DefaultFulfillmentGroupSubmitValidator
java.lang.Object
com.broadleafcommerce.cartoperation.service.fulfillment.validation.DefaultFulfillmentGroupSubmitValidator
- All Implemented Interfaces:
FulfillmentGroupSubmitValidator
,FulfillmentValidator
,org.springframework.validation.SmartValidator
,org.springframework.validation.Validator
public class DefaultFulfillmentGroupSubmitValidator
extends Object
implements FulfillmentGroupSubmitValidator
Performs validation for a fulfillment group. This mainly delegates to other validators the are
able to validate with more specific conditions.
- Author:
- Jacob Mitash
-
Field Summary
Fields inherited from interface com.broadleafcommerce.cartoperation.service.fulfillment.validation.FulfillmentGroupSubmitValidator
HINT_ALLOW_NO_ITEMS, HINT_ALLOW_NO_OPTION, HINT_PRICING_NOT_REQUIRED, HINT_SKIP_ITEM_VALIDATION, HINT_SKIP_OPTION_VALIDATION, HINT_SKIP_TYPE_SPECIFIC_VALIDATION
-
Constructor Summary
ConstructorDescriptionDefaultFulfillmentGroupSubmitValidator
(Set<TypeFulfillmentGroupSubmitValidator> typeValidators, Set<FulfillmentItemSubmitValidator> itemValidators, Set<FulfillmentOptionSubmitValidator> optionValidators) -
Method Summary
Modifier and TypeMethodDescriptionprotected Set<FulfillmentItemSubmitValidator>
protected Set<FulfillmentOptionSubmitValidator>
Class<?>
Gets the class that this validator supports.protected Set<TypeFulfillmentGroupSubmitValidator>
Produces a set of field names of pricing fields that should be validated.void
validate
(@NonNull Object target, @NonNull org.springframework.validation.Errors errors, @NonNull Set<Object> hints) Validates the target.protected void
validateBase
(@NonNull com.broadleafcommerce.cart.client.domain.FulfillmentGroup group, @NonNull org.springframework.validation.Errors errors, @NonNull Set<Object> hints) Validates a fulfillment group at the top level, not considering nested or pricing fields.protected void
validateItems
(@NonNull com.broadleafcommerce.cart.client.domain.FulfillmentGroup group, @NonNull org.springframework.validation.Errors errors, @NonNull Set<Object> hints) Validates the fulfillment items of the group.protected void
validateOptions
(@NonNull com.broadleafcommerce.cart.client.domain.FulfillmentGroup group, @NonNull org.springframework.validation.Errors errors, @NonNull Set<Object> hints) Validates the fulfillment option on this group.protected void
validatePricing
(@NonNull com.broadleafcommerce.cart.client.domain.FulfillmentGroup group, @NonNull org.springframework.validation.Errors errors, @NonNull Set<Object> hints) Validates the price fields on the fulfillment group (top-level only- does not consider individual item prices).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
-
DefaultFulfillmentGroupSubmitValidator
public DefaultFulfillmentGroupSubmitValidator(Set<TypeFulfillmentGroupSubmitValidator> typeValidators, Set<FulfillmentItemSubmitValidator> itemValidators, Set<FulfillmentOptionSubmitValidator> optionValidators)
-
-
Method Details
-
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> hints) 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 fromhints
- any hints that should be used during validation
-
validateBase
protected void validateBase(@NonNull @NonNull com.broadleafcommerce.cart.client.domain.FulfillmentGroup group, @NonNull @NonNull org.springframework.validation.Errors errors, @NonNull @NonNull Set<Object> hints) Validates a fulfillment group at the top level, not considering nested or pricing fields. By default, this will also delegate totypeValidators
to validate things that would be specific to the fulfillment type being used.- Parameters:
group
- the fulfillment group to validateerrors
- an error container to place validation errors inhints
- any hints to use when validating the group
-
validatePricing
protected void validatePricing(@NonNull @NonNull com.broadleafcommerce.cart.client.domain.FulfillmentGroup group, @NonNull @NonNull org.springframework.validation.Errors errors, @NonNull @NonNull Set<Object> hints) Validates the price fields on the fulfillment group (top-level only- does not consider individual item prices).- Parameters:
group
- the fulfillment group to validateerrors
- an error container to place validation errors inhints
- any hints to use when validating the group
-
validateItems
protected void validateItems(@NonNull @NonNull com.broadleafcommerce.cart.client.domain.FulfillmentGroup group, @NonNull @NonNull org.springframework.validation.Errors errors, @NonNull @NonNull Set<Object> hints) Validates the fulfillment items of the group. Delegates toitemValidators
for the actual validation.- Parameters:
group
- the fulfillment group to validateerrors
- an error container to place validation errors inhints
- any hints to use when validating the group
-
validateOptions
protected void validateOptions(@NonNull @NonNull com.broadleafcommerce.cart.client.domain.FulfillmentGroup group, @NonNull @NonNull org.springframework.validation.Errors errors, @NonNull @NonNull Set<Object> hints) Validates the fulfillment option on this group. Delegates tooptionValidators
.- Parameters:
group
- the fulfillment group to validateerrors
- an error container to place validation errors inhints
- any hints to use when validating the group
-
pricingFields
Produces a set of field names of pricing fields that should be validated. These are the simple field names (i.e. no nested paths).- Returns:
- the price field names
-
getTypeValidators
-
getItemValidators
-
getOptionValidators
-
getPricingFields
-