Package megamek.common.util
Class YamlEncDec
java.lang.Object
megamek.common.util.YamlEncDec
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidDeprecated, for removal: This API element is subject to removal in a future version.static voidstatic NumberformatDouble(double value) Formats a double value to avoid scientific notation in YAML output.serialize(EquipmentType equipmentType) Serializes an EquipmentType to a YAML-compatible map.static voidwriteEquipmentDatabase(String targetFolder)
-
Constructor Details
-
YamlEncDec
public YamlEncDec()
-
-
Method Details
-
serialize
Serializes an EquipmentType to a YAML-compatible map. The equipment type's getYamlData() method handles all serialization, including type-specific data, flags, and version information.- Parameters:
equipmentType- The EquipmentType to serialize.- Returns:
- A Map containing the serialized data.
-
addPropIfNotEmpty
-
formatDouble
Formats a double value to avoid scientific notation in YAML output. Returns the appropriate Number type for clean serialization.- Parameters:
value- The double value to format- Returns:
- Long for whole numbers, BigDecimal for decimals
-
addPropIfNotDefault
@Deprecated(since="0.51.0", forRemoval=true) public static void addPropIfNotDefault(Map<String, Object> data, String key, Object value, Object defaultValue) Deprecated, for removal: This API element is subject to removal in a future version. -
writeEquipmentDatabase
-