Class BusinessStatistics.Transaction
java.lang.Object
us.teaminceptus.novaconomy.api.business.BusinessStatistics.Transaction
- All Implemented Interfaces:
ConfigurationSerializable
- Enclosing class:
- BusinessStatistics
public static final class BusinessStatistics.Transaction
extends Object
implements ConfigurationSerializable
Represents a Transaction for a Business
-
Constructor Summary
ConstructorsConstructorDescriptionConstructs a Transaction with no buyer or product.Transaction(@Nullable OfflinePlayer buyer, @Nullable Business business, @Nullable Product product) Constructs a Transaction with a timestamp equalingSystem.currentTimeMillis().Transaction(@Nullable OfflinePlayer buyer, @Nullable Business business, @Nullable Product product, long timestamp) Constructs a Transaction.Transaction(@Nullable OfflinePlayer buyer, @Nullable Business business, @Nullable Product product, @NotNull Date timestamp) Constructs a Transaction.Transaction(@Nullable OfflinePlayer buyer, @Nullable BusinessProduct product) Constructs a Transaction with a timestamp equalingSystem.currentTimeMillis().Transaction(@Nullable OfflinePlayer buyer, @Nullable BusinessProduct product, long timestamp) Constructs a Transaction. -
Method Summary
Modifier and TypeMethodDescriptionstatic @Nullable BusinessStatistics.Transactiondeserialize(@NotNull Map<String, Object> serial) Deserializes a Map into a Transaction.@Nullable BusinessReturns the Business that the transaction took place in.@Nullable OfflinePlayergetBuyer()Returns the buyer of the transaction@Nullable ProductReturns the product of the transaction@NotNull DateReturns the timestamp of the transactionvoidsetBusiness(@NotNull Business business) Sets the business of this transaction.voidsetBuyer(@Nullable OfflinePlayer buyer) Sets the buyer of this transaction.voidsetProduct(@Nullable Product product) Sets the product of this transaction.voidsetTimestamp(long timestamp) Sets the timestamp of this transaction.voidsetTimestamp(@NotNull Date timestamp) Sets the timestamp of this transaction.
-
Constructor Details
-
Transaction
public Transaction()Constructs a Transaction with no buyer or product. -
Transaction
public Transaction(@Nullable @Nullable OfflinePlayer buyer, @Nullable @Nullable Business business, @Nullable @Nullable Product product) Constructs a Transaction with a timestamp equalingSystem.currentTimeMillis().- Parameters:
buyer- Buyer of the Productproduct- Product boughtbusiness- Business that the transaction took place in
-
Transaction
public Transaction(@Nullable @Nullable OfflinePlayer buyer, @Nullable @Nullable BusinessProduct product) Constructs a Transaction with a timestamp equalingSystem.currentTimeMillis().- Parameters:
buyer- Buyer of the Productproduct- Business Product bought
-
Transaction
public Transaction(@Nullable @Nullable OfflinePlayer buyer, @Nullable @Nullable Business business, @Nullable @Nullable Product product, long timestamp) throws IllegalArgumentException Constructs a Transaction.- Parameters:
buyer- Player who bought the Productbusiness- Business that the transaction took place inproduct- Product that was boughttimestamp- Time that the Transaction was made- Throws:
IllegalArgumentException- if timestamp is negative
-
Transaction
public Transaction(@Nullable @Nullable OfflinePlayer buyer, @Nullable @Nullable BusinessProduct product, long timestamp) throws IllegalArgumentException Constructs a Transaction.- Parameters:
buyer- Player who bought the Productproduct- Business Product that was boughttimestamp- Time that the Transaction was made- Throws:
IllegalArgumentException- if timestamp is negative
-
Transaction
public Transaction(@Nullable @Nullable OfflinePlayer buyer, @Nullable @Nullable Business business, @Nullable @Nullable Product product, @NotNull @NotNull Date timestamp) throws NullPointerException Constructs a Transaction.- Parameters:
buyer- Player who bought the Productbusiness- Business that the transaction took place inproduct- Product that was boughttimestamp- Date Object of the time that the Transaction was made- Throws:
NullPointerException- if Date is null
-
-
Method Details
-
getBuyer
Returns the buyer of the transaction- Returns:
- Buyer of the transaction, may be null
-
getProduct
Returns the product of the transaction- Returns:
- Product of the transaction, may be null
-
getTimestamp
Returns the timestamp of the transaction- Returns:
- Timestamp of the transaction
-
setBuyer
Sets the buyer of this transaction.- Parameters:
buyer- Buyer to set
-
setProduct
Sets the product of this transaction.- Parameters:
product- Product to set
-
setTimestamp
Sets the timestamp of this transaction.- Parameters:
timestamp- Timestamp to set- Throws:
IllegalArgumentException- if timestamp is negative
-
setTimestamp
Sets the timestamp of this transaction.- Parameters:
timestamp- Date Object of the timestamp to set- Throws:
NullPointerException- if Date is null
-
getBusiness
Returns the Business that the transaction took place in.- Returns:
- Business that the transaction took place in.
-
setBusiness
Sets the business of this transaction.- Parameters:
business- Business to set
-
serialize
- Specified by:
serializein interfaceConfigurationSerializable
-
deserialize
@Nullable public static @Nullable BusinessStatistics.Transaction deserialize(@NotNull @NotNull Map<String, Object> serial) throws IllegalArgumentExceptionDeserializes a Map into a Transaction.- Parameters:
serial- Serialization fromserialize()- Returns:
- Deserialized Transaction, or null if serial is null
- Throws:
IllegalArgumentException- if an argument is missing/malformed
-