Class BusinessStatistics
java.lang.Object
us.teaminceptus.novaconomy.api.business.BusinessStatistics
- All Implemented Interfaces:
ConfigurationSerializable
Utility Class for Business Statistics
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classRepresents a Transaction for a Business -
Method Summary
Modifier and TypeMethodDescriptionvoidaddView()Adds one view to the total amount of views for this Business.voidaddView(int views) Adds to the total amount of views for this Business.static @Nullable BusinessStatisticsdeserialize(@NotNull Map<String, Object> serial) Deserializes a Map into a BusinessStatistics.@NotNull UUIDFetches the Business ID for this BusinessStatistics.@Nullable BusinessStatistics.TransactionFetches the last transaction for this Business.Fetches a Map of Products to how much was bought of it.intgetPurchaseCount(@NotNull Product product) Fetches how much of a Product was bought from this Business.intFetches the total amount of stock ever added to this Business.intGets the total amount of items purchased from this Business.intgetViews()Fetches the total amount of times this Business was viewed.booleanWhether a Transaction has been made for this Business.voidsetLastTransaction(@NotNull BusinessStatistics.Transaction last) Sets the latest transaction for this Business.voidsetTotalSales(int sales) Sets the total amount of sales for this Business.voidsetViews(int views) Sets the total amount of views for this Business.
-
Method Details
-
getBusinessId
Fetches the Business ID for this BusinessStatistics.- Returns:
- Business ID
-
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
Fetches a Map of Products to how much was bought of it.- Returns:
- Product Sales
-
getPurchaseCount
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
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
- Specified by:
serializein interfaceConfigurationSerializable
-
deserialize
@Nullable public static @Nullable BusinessStatistics deserialize(@NotNull @NotNull Map<String, Object> serial) throws IllegalArgumentException, NullPointerExceptionDeserializes a Map into a BusinessStatistics.- Parameters:
serial- Serialization fromserialize()- Returns:
- Deserialized BusinessStatistics, or null if serial is null
- Throws:
IllegalArgumentException- if an argument is malformedNullPointerException- if ID is missing
-