Class Item

java.lang.Object
com.adventure.models.items.Item
Direct Known Subclasses:
AttackItem, DefenceItem, Key, UsableItem

public abstract class Item extends Object
Class that represents a generic item.
  • Field Details

    • name

      protected String name
      Item name.
    • weight

      protected int weight
      Item weight.
  • Constructor Details

    • Item

      public Item(String name)
      Default constructor
      • weight: 0
      Parameters:
      name - Name of the item
  • Method Details

    • getName

      public String getName()
      Get the name of the item
      Returns:
      name of the item
    • getWeight

      public int getWeight()
      Get the weight of the item
      Returns:
      weight of the item
    • setWeight

      public void setWeight(int weight)
      Set the weight of the item
      Parameters:
      weight - weight of the item
    • equals

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

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object