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

    Constructors
    Constructor
    Description
    Deprecated, for removal: This API element is subject to removal in a future version.
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    serialize(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, wrapAndThrow

    Methods inherited from class com.fasterxml.jackson.databind.JsonSerializer

    getDelegatee, isEmpty, isEmpty, isUnwrappingSerializer, properties, replaceDelegatee, serializeWithType, unwrappingSerializer, usesObjectId, withFilterId, withIgnoredProperties

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • ASElementSerializer

      @Deprecated(since="0.51.0", forRemoval=true) public ASElementSerializer()
      Deprecated, for removal: This API element is subject to removal in a future version.
    • ASElementSerializer

      public ASElementSerializer(Class<ASCardDisplayable> t)
  • Method Details

    • serialize

      public void serialize(ASCardDisplayable element, com.fasterxml.jackson.core.JsonGenerator jsonGenerator, com.fasterxml.jackson.databind.SerializerProvider provider) throws IOException
      Specified by:
      serialize in class com.fasterxml.jackson.databind.ser.std.StdSerializer<ASCardDisplayable>
      Throws:
      IOException