Class WeightedSerializableObject<T extends DataSerializable>
- java.lang.Object
-
- org.spongepowered.api.util.weighted.TableEntry<T>
-
- org.spongepowered.api.util.weighted.WeightedObject<T>
-
- org.spongepowered.api.util.weighted.WeightedSerializableObject<T>
-
- Type Parameters:
T
- The entry type
- All Implemented Interfaces:
DataSerializable
public class WeightedSerializableObject<T extends DataSerializable> extends WeightedObject<T> implements DataSerializable
An entry which contains an object with the added restriction that the object be serializable.
-
-
Constructor Summary
Constructors Constructor Description WeightedSerializableObject(T object, int weight)
Creates a newWeightedSerializableObject
with the providedDataSerializable
.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
contentVersion()
Gets the content version of thisDataSerializable
.boolean
equals(java.lang.Object o)
DataContainer
toContainer()
Serializes this object into a comprehensibleDataContainer
.java.lang.String
toString()
-
Methods inherited from class org.spongepowered.api.util.weighted.WeightedObject
get, hashCode
-
Methods inherited from class org.spongepowered.api.util.weighted.TableEntry
weight
-
-
-
-
Constructor Detail
-
WeightedSerializableObject
public WeightedSerializableObject(T object, int weight)
Creates a newWeightedSerializableObject
with the providedDataSerializable
.- Parameters:
object
- The serializable objectweight
- The weight
-
-
Method Detail
-
toString
public java.lang.String toString()
- Overrides:
toString
in classWeightedObject<T extends DataSerializable>
-
equals
public boolean equals(java.lang.Object o)
- Overrides:
equals
in classWeightedObject<T extends DataSerializable>
-
contentVersion
public int contentVersion()
Description copied from interface:DataSerializable
Gets the content version of thisDataSerializable
. The version may differ between instances of plugins and implementations such that theDataView
fromDataSerializable.toContainer()
may include different information, or remove other information as they are no longer deemed necessary. The version goes hand in hand withDataContentUpdater
as it is required when there exists anyDataView
of thisDataSerializable
with an "older" version.- Specified by:
contentVersion
in interfaceDataSerializable
- Returns:
- The version of the content being serialized
-
toContainer
public DataContainer toContainer()
Description copied from interface:DataSerializable
Serializes this object into a comprehensibleDataContainer
.- Specified by:
toContainer
in interfaceDataSerializable
- Returns:
- A newly created DataContainer
-
-