Options
All
  • Public
  • Public/Protected
  • All
Menu

Represents Serializer plugin component.

Like Converter plugins each Serializer plugin defines a predicate that instructs if an object can be serialized by it, this is done dynamically at runtime via a supports method.

Additionally, each Serializer plugin must define a predicate that instructs the group it belongs to.

Serializers are grouped to improve performance when finding serializers that apply to a node, this makes it possible to skip the supports calls for Types when searching for a Reflection and vise versa.

Type parameters

  • T

Hierarchy

  • SerializerComponent

Index

Constructors

constructor

Properties

Protected owner

owner: Serializer

Set when the SerializerComponent is added to the serializer.

Static PRIORITY

PRIORITY: number = 0

The priority this serializer should be executed with. A higher priority means the Serializer will be applied earlier.

Accessors

priority

  • get priority(): number

Methods

Abstract serializeGroup

  • serializeGroup(instance: unknown): boolean
  • A high-level predicate filtering which group this serializer belongs to. This is a high-level filter before the SerializerComponent.supports predicate filter.

    For example, use the Reflection class class to group all reflection based serializers:

    class ReflectionSerializer {
    serializeGroup(instance) { return instance instanceof Reflection }
    }

    Use the Type class to group all type based serializers:

    class TypeSerializer {
    serializeGroup(instance) { return instance instanceof Type }
    }

    Parameters

    • instance: unknown

    Returns boolean

Abstract supports

  • supports(item: unknown): boolean

Abstract toObject

Generated using TypeDoc