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 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 equaling System.currentTimeMillis().
      Parameters:
      buyer - Buyer of the Product
      product - Product bought
      business - Business that the transaction took place in
    • Transaction

      public Transaction(@Nullable @Nullable OfflinePlayer buyer, @Nullable @Nullable BusinessProduct product)
      Constructs a Transaction with a timestamp equaling System.currentTimeMillis().
      Parameters:
      buyer - Buyer of the Product
      product - 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 Product
      business - Business that the transaction took place in
      product - Product that was bought
      timestamp - 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 Product
      product - Business Product that was bought
      timestamp - 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 Product
      business - Business that the transaction took place in
      product - Product that was bought
      timestamp - Date Object of the time that the Transaction was made
      Throws:
      NullPointerException - if Date is null
  • Method Details

    • getBuyer

      @Nullable public @Nullable OfflinePlayer getBuyer()
      Returns the buyer of the transaction
      Returns:
      Buyer of the transaction, may be null
    • getProduct

      @Nullable public @Nullable Product getProduct()
      Returns the product of the transaction
      Returns:
      Product of the transaction, may be null
    • getTimestamp

      @NotNull public @NotNull Date getTimestamp()
      Returns the timestamp of the transaction
      Returns:
      Timestamp of the transaction
    • setBuyer

      public void setBuyer(@Nullable @Nullable OfflinePlayer buyer)
      Sets the buyer of this transaction.
      Parameters:
      buyer - Buyer to set
    • setProduct

      public void setProduct(@Nullable @Nullable Product product)
      Sets the product of this transaction.
      Parameters:
      product - Product to set
    • setTimestamp

      public void setTimestamp(long timestamp) throws IllegalArgumentException
      Sets the timestamp of this transaction.
      Parameters:
      timestamp - Timestamp to set
      Throws:
      IllegalArgumentException - if timestamp is negative
    • setTimestamp

      public void setTimestamp(@NotNull @NotNull Date timestamp) throws NullPointerException
      Sets the timestamp of this transaction.
      Parameters:
      timestamp - Date Object of the timestamp to set
      Throws:
      NullPointerException - if Date is null
    • getBusiness

      @Nullable public @Nullable Business getBusiness()
      Returns the Business that the transaction took place in.
      Returns:
      Business that the transaction took place in.
    • setBusiness

      public void setBusiness(@NotNull @NotNull Business business)
      Sets the business of this transaction.
      Parameters:
      business - Business to set
    • serialize

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

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