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
Represents a serializable product that can be sold in an auction. This class is used to store the product in the database.
- See Also:
-
Nested Class Summary
-
Constructor Summary
ConstructorDescriptionASerializableProduct
(String productProvider, byte[] bytes, ASerializableProduct.SerializableFunction<byte[], T> function) -
Method Summary
Modifier and TypeMethodDescriptionlong
byte[]
getBytes()
long
long
getSerializableProduct
(long amount) byte[]
void
setAmount
(long amount) void
setMaxAmount
(long maxAmount) void
setNaturalAmount
(long naturalAmount)
-
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
-
getBytes
public byte[] getBytes()- Returns:
- The bytes of the product.
-
getHandleProduct
- Returns:
- The function to convert the bytes to the product.
-
getProduct
- Returns:
- The product.
-
getSerializableProduct
-
serialize
public byte[] serialize()- Returns:
- The serialized version of this object.
-