# Class GiftWrappingDecorator

java.lang.Object
com.university.bookstore.model.Material
com.university.bookstore.decorator.MaterialDecorator
com.university.bookstore.decorator.GiftWrappingDecorator

All Implemented Interfaces:
  `Comparable<Material>`

public class GiftWrappingDecorator extends MaterialDecorator
Decorator that adds gift wrapping functionality to materials. Increases the price and provides gift wrapping information.

Since:
  2024-09-15
Version:
  3.0
Author:
  Navid Mohaghegh

- ## Nested Class Summary

  ### Nested classes/interfaces inherited from class com.university.bookstore.model.Material

  `Material.MaterialType`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `GiftWrappingDecorator(Material material, String wrappingStyle)`
  Creates a new gift wrapping decorator.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `boolean`
  `equals(Object obj)`
  Materials are equal if they have the same ID.
  `String`
  `getDisplayInfo()`
  Abstract method to get a formatted display string.
  `double`
  `getGiftWrappingCost()`
  Gets the gift wrapping cost.
  `double`
  `getPrice()`
  `String`
  `getWrappingStyle()`
  Gets the wrapping style.
  `int`
  `hashCode()`

  ### Methods inherited from class com.university.bookstore.decorator.MaterialDecorator

  `getBaseMaterial, getCreator, getDecoratedMaterial, getDecoratorCount, getDiscountRate, hasDecorators, toString`

  ### Methods inherited from class com.university.bookstore.model.Material

  `compareTo, getDiscountedPrice, getId, getTitle, getType, getYear`

  ### Methods inherited from class java.lang.Object

  `getClass, notify, notifyAll, wait, wait, wait`

- ## Constructor Details

  - ### GiftWrappingDecorator

    public GiftWrappingDecorator(Material material, String wrappingStyle)
    Creates a new gift wrapping decorator.
    Parameters:
      `material` - the material to wrap
      `wrappingStyle` - the style of gift wrapping
    Throws:
      `IllegalArgumentException` - if wrappingStyle is null or empty

- ## Method Details

  - ### getPrice

    public double getPrice()
    Overrides:
      `getPrice` in class `Material`

  - ### getDisplayInfo

    public String getDisplayInfo()
    Description copied from class: `Material`
    Abstract method to get a formatted display string. Each material type should provide its own formatting.
    Overrides:
      `getDisplayInfo` in class `MaterialDecorator`
    Returns:
      formatted display string

  - ### getWrappingStyle

    public String getWrappingStyle()
    Gets the wrapping style.
    Returns:
      the wrapping style

  - ### getGiftWrappingCost

    public double getGiftWrappingCost()
    Gets the gift wrapping cost.
    Returns:
      the gift wrapping cost

  - ### equals

    public boolean equals(Object obj)
    Description copied from class: `Material`
    Materials are equal if they have the same ID.
    Overrides:
      `equals` in class `MaterialDecorator`

  - ### hashCode

    public int hashCode()
    Overrides:
      `hashCode` in class `MaterialDecorator`