Class ASerializableProduct<T>

java.lang.Object
com.olziedev.playerauctions.api.auction.product.ASerializableProduct<T>
Type Parameters:
T - The type of the product.
All Implemented Interfaces:
Serializable

public class ASerializableProduct<T> extends Object implements Serializable
Represents a serializable product that can be sold in an auction. This class is used to store the product in the database.
See Also:
  • Constructor Details

    • ASerializableProduct

      public ASerializableProduct(String productProvider, byte[] bytes, ASerializableProduct.SerializableFunction<byte[],T> function)
      Parameters:
      bytes - The bytes of the product.
      function - The function to convert the bytes to the product.
  • Method Details

    • setAmount

      public void setAmount(long amount)
      Parameters:
      amount - The amount of products sold.
    • setMaxAmount

      public void setMaxAmount(long maxAmount)
      Parameters:
      maxAmount - The maximum amount of products sold.
    • getAmount

      public long getAmount()
      Returns:
      The amount of products sold.
    • getMaxAmount

      public long getMaxAmount()
      Returns:
      The maximum amount of products sold.
    • setNaturalAmount

      public void setNaturalAmount(long naturalAmount)
    • getNaturalAmount

      public long getNaturalAmount()
    • getProductProvider

      public AProductProvider<?> getProductProvider(PlayerAuctionsAPI api)
    • getBytes

      public byte[] getBytes()
      Returns:
      The bytes of the product.
    • getHandleProduct

      public T getHandleProduct()
      Returns:
      The function to convert the bytes to the product.
    • getProduct

      public AProduct getProduct()
      Returns:
      The product.
    • getSerializableProduct

      public ASerializableProduct<T> getSerializableProduct(long amount)
    • serialize

      public byte[] serialize()
      Returns:
      The serialized version of this object.