Class FarmerItem

java.lang.Object
xyz.geik.farmer.model.inventory.FarmerItem

public class FarmerItem extends Object
Farmer item which contains item name, price, amount and material. Farmer item is an item which farmer can store in his inventory.
Author:
Geik
  • Constructor Details

    • FarmerItem

      public FarmerItem(String name, double price, long amount)
      Constructor of FarmerItem
      Parameters:
      name - of item
      price - of item
      amount - of item
  • Method Details

    • clone

      public FarmerItem clone()
      Clones FarmerItem
      Overrides:
      clone in class Object
      Returns:
      FarmerItem
    • sumAmount

      public void sumAmount(long sum)
      Summing x to amount
      Parameters:
      sum - sum amount
    • negateAmount

      public void negateAmount(long negate)
      Negating x from amount
      Parameters:
      negate - negate amount
    • serializeItems

      public static String serializeItems(@NotNull @NotNull List<FarmerItem> items)
      Serializing FarmerItem set to flat string Because it should save to database
      Parameters:
      items - list of item
      Returns:
      serialized string
    • deserializeItems

      public static List<FarmerItem> deserializeItems(String items)
      Deserialize FarmerItem from flat string to a list
      Parameters:
      items - serialized item list
      Returns:
      List deserialized item list