Package megamek.common.jacksonAdapters
Class ASElementSerializer
java.lang.Object
com.fasterxml.jackson.databind.JsonSerializer<ASCardDisplayable>
com.fasterxml.jackson.databind.ser.std.StdSerializer<ASCardDisplayable>
megamek.common.jacksonAdapters.ASElementSerializer
- All Implemented Interfaces:
com.fasterxml.jackson.databind.jsonFormatVisitors.JsonFormatVisitable,com.fasterxml.jackson.databind.jsonschema.SchemaAware,Serializable
public class ASElementSerializer
extends com.fasterxml.jackson.databind.ser.std.StdSerializer<ASCardDisplayable>
This Jackson serializer writes AlphaStrikeElements to YAML output.
When the unit is canon (found in the MekSummaryCache and marked as canon), then the full name (chassis+model) is written in addition to the unit type (ASElement); for deserialization, the unit is re-converted from the TW Entity.
For a non-canon unit, the chassis, model and AS values are written as far as needed to reconstruct the unit without the cache (this does not include TMM, Threshold and PV which can be calculated from the other AS values).
The pilot skill is written unless it is 4. When the skill is missing, deserialization assumes 4.
In addition, any transients like damage are written if present (2024: only partially implemented).
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class com.fasterxml.jackson.databind.JsonSerializer
com.fasterxml.jackson.databind.JsonSerializer.None -
Field Summary
Fields inherited from class com.fasterxml.jackson.databind.ser.std.StdSerializer
_handledType -
Constructor Summary
ConstructorsConstructorDescriptionDeprecated, for removal: This API element is subject to removal in a future version. -
Method Summary
Modifier and TypeMethodDescriptionvoidserialize(ASCardDisplayable element, com.fasterxml.jackson.core.JsonGenerator jsonGenerator, com.fasterxml.jackson.databind.SerializerProvider provider) Methods inherited from class com.fasterxml.jackson.databind.ser.std.StdSerializer
_neitherNull, _nonEmpty, acceptJsonFormatVisitor, createSchemaNode, createSchemaNode, findAnnotatedContentSerializer, findContextualConvertingSerializer, findConvertingContentSerializer, findFormatFeature, findFormatOverrides, findIncludeOverrides, findPropertyFilter, getSchema, getSchema, handledType, isDefaultSerializer, visitArrayFormat, visitArrayFormat, visitFloatFormat, visitIntFormat, visitIntFormat, visitStringFormat, visitStringFormat, wrapAndThrow, wrapAndThrowMethods inherited from class com.fasterxml.jackson.databind.JsonSerializer
getDelegatee, isEmpty, isEmpty, isUnwrappingSerializer, properties, replaceDelegatee, serializeWithType, unwrappingSerializer, usesObjectId, withFilterId, withIgnoredProperties
-
Constructor Details
-
ASElementSerializer
Deprecated, for removal: This API element is subject to removal in a future version. -
ASElementSerializer
-
-
Method Details
-
serialize
public void serialize(ASCardDisplayable element, com.fasterxml.jackson.core.JsonGenerator jsonGenerator, com.fasterxml.jackson.databind.SerializerProvider provider) throws IOException - Specified by:
serializein classcom.fasterxml.jackson.databind.ser.std.StdSerializer<ASCardDisplayable>- Throws:
IOException
-