Class CategoryDTO

java.lang.Object
com.goldenleaf.shop.dto.CategoryDTO

public class CategoryDTO extends Object
Data Transfer Object for Category entity.

Used for:

  • Creating or updating product categories via REST API
  • Returning category information in responses (list, details)
  • Transferring data between layers (controller ↔ service)

Category names should be unique and descriptive (e.g., "Smartphones", "Laptops", "Books").

Since:
1.0
  • Constructor Details

    • CategoryDTO

      public CategoryDTO()
      Default constructor required for JSON deserialization (Jackson, Gson)
    • CategoryDTO

      public CategoryDTO(Long id, String name)
      Convenience constructor for manual object creation or mapping.
      Parameters:
      id - category identifier (may be null for new categories)
      name - category name
  • Method Details

    • getId

      public Long getId()
    • setId

      public void setId(Long id)
    • getName

      public String getName()
    • setName

      public void setName(String name)
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object