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 newWeightedSerializableObjectwith the providedDataSerializable.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intcontentVersion()Gets the content version of thisDataSerializable.booleanequals(Object o)DataContainertoContainer()Serializes this object into a comprehensibleDataContainer.StringtoString()-
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 newWeightedSerializableObjectwith the providedDataSerializable.- Parameters:
object- The serializable objectweight- The weight
-
-
Method Detail
-
toString
public String toString()
- Overrides:
toStringin classWeightedObject<T extends DataSerializable>
-
equals
public boolean equals(Object o)
- Overrides:
equalsin classWeightedObject<T extends DataSerializable>
-
contentVersion
public int contentVersion()
Description copied from interface:DataSerializableGets the content version of thisDataSerializable. The version may differ between instances of plugins and implementations such that theDataViewfromDataSerializable.toContainer()may include different information, or remove other information as they are no longer deemed necessary. The version goes hand in hand withDataContentUpdateras it is required when there exists anyDataViewof thisDataSerializablewith an "older" version.- Specified by:
contentVersionin interfaceDataSerializable- Returns:
- The version of the content being serialized
-
toContainer
public DataContainer toContainer()
Description copied from interface:DataSerializableSerializes this object into a comprehensibleDataContainer.- Specified by:
toContainerin interfaceDataSerializable- Returns:
- A newly created DataContainer
-
-