Class BusinessStatistics

java.lang.Object
us.teaminceptus.novaconomy.api.business.BusinessStatistics
All Implemented Interfaces:
ConfigurationSerializable

public final class BusinessStatistics extends Object implements ConfigurationSerializable
Utility Class for Business Statistics
  • Method Details

    • getBusinessId

      @NotNull public @NotNull UUID getBusinessId()
      Fetches the Business ID for this BusinessStatistics.
      Returns:
      Business ID
    • getLastTransaction

      @Nullable public @Nullable BusinessStatistics.Transaction getLastTransaction()
      Fetches the last transaction for this Business.
      Returns:
      Last Transaction, or null if there are none
    • hasLatestTransaction

      public boolean hasLatestTransaction()
      Whether a Transaction has been made for this Business.
      Returns:
      true if a transaction was made, else false
    • getTotalSales

      public int getTotalSales()
      Gets the total amount of items purchased from this Business.
      Returns:
      Total Sales
    • getTotalResources

      public int getTotalResources()
      Fetches the total amount of stock ever added to this Business.
      Returns:
      Total Resources
    • getViews

      public int getViews()
      Fetches the total amount of times this Business was viewed.
      Returns:
      Total Views
    • setViews

      public void setViews(int views)
      Sets the total amount of views for this Business.
      Parameters:
      views - Total Views
    • addView

      public void addView(int views)
      Adds to the total amount of views for this Business.
      Parameters:
      views - Views to add
    • addView

      public void addView()
      Adds one view to the total amount of views for this Business.
    • getProductSales

      @NotNull public @NotNull Map<Product,Integer> getProductSales()
      Fetches a Map of Products to how much was bought of it.
      Returns:
      Product Sales
    • getPurchaseCount

      public int getPurchaseCount(@NotNull @NotNull Product product)
      Fetches how much of a Product was bought from this Business.
      Parameters:
      product - Product to fetch
      Returns:
      Amount of Product bought, or 0 if none
    • setLastTransaction

      public void setLastTransaction(@NotNull @NotNull BusinessStatistics.Transaction last)
      Sets the latest transaction for this Business.
      Parameters:
      last - Transaction to set
    • setTotalSales

      public void setTotalSales(int sales)
      Sets the total amount of sales for this Business.
      Parameters:
      sales - Total Sales
    • serialize

      public Map<String,Object> serialize()
      Specified by:
      serialize in interface ConfigurationSerializable
    • deserialize

      @Nullable public static @Nullable BusinessStatistics deserialize(@NotNull @NotNull Map<String,Object> serial) throws IllegalArgumentException, NullPointerException
      Deserializes a Map into a BusinessStatistics.
      Parameters:
      serial - Serialization from serialize()
      Returns:
      Deserialized BusinessStatistics, or null if serial is null
      Throws:
      IllegalArgumentException - if an argument is malformed
      NullPointerException - if ID is missing