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
ConstructorDescriptionWeightedSerializableObject
(T object, int weight) Creates a newWeightedSerializableObject
with the providedDataSerializable
. -
Method Summary
Modifier and TypeMethodDescriptionint
Gets the content version of thisDataSerializable
.boolean
Serializes this object into a comprehensibleDataContainer
.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 Details
-
WeightedSerializableObject
Creates a newWeightedSerializableObject
with the providedDataSerializable
.- Parameters:
object
- The serializable objectweight
- The weight
-
-
Method Details
-
toString
- Overrides:
toString
in classWeightedObject<T extends DataSerializable>
-
equals
- 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
Description copied from interface:DataSerializable
Serializes this object into a comprehensibleDataContainer
.- Specified by:
toContainer
in interfaceDataSerializable
- Returns:
- A newly created DataContainer
-