Class ProductOption

  • All Implemented Interfaces:
    Serializable

    public class ProductOption
    extends Object
    implements Serializable

    A "product option" encapsulates additional, variable information about a Product explicitly designed for customer-facing input. This can be info necessary for distinguishing particular variants such as shirt size, color, or material, or it can be some custom user-input such as a name to emboss on the back of a jersey. Finally, it can even drive additional products that should be added to the cart along with the product that it is configured for.

    Author:
    Nathan Moore (nathandmoore)
    See Also:
    Serialized Form
    • Constructor Detail

      • ProductOption

        public ProductOption()
    • Method Detail

      • addAttribute

        public void addAttribute​(String name,
                                 Object value)
        Takes in any additional attributes passed in the request not matching any defined properties.
        Parameters:
        name - Name of the additional attribute
        value - Value of the additional attribute
      • getAttribute

        public Map<String,​Object> getAttribute()
        Return any additional attributes passed in the request not matching any defined properties.
        Returns:
        any additional attributes passed in the request not matching any defined properties.
      • getType

        public String getType()
        Controls both how the customer should be inputting values to fill out this option as well as storage of where the value will go once added to the cart.
        Returns:
        which type of input this option is configured for
        See Also:
        DefaultProductOptionType
      • getAttributes

        public Map<String,​Object> getAttributes()
        Map holding any additional attributes passed in the request not matching any defined properties.
      • setType

        public void setType​(String type)
        Controls both how the customer should be inputting values to fill out this option as well as storage of where the value will go once added to the cart.
        Parameters:
        type - the type of input that the drives customer selection, defaults from DefaultProductOptionType
        See Also:
        DefaultProductOptionType
      • setAttributes

        public void setAttributes​(Map<String,​Object> attributes)
        Map holding any additional attributes passed in the request not matching any defined properties.
      • canEqual

        protected boolean canEqual​(Object other)
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object