Class TriggerSerializer<TTrigger>
- Namespace
- Quartz.Serialization.SystemTextJson.Triggers
- Assembly
- Quartz.dll
Base class for a custom trigger type's JSON serializer.
public abstract class TriggerSerializer<TTrigger> : ITriggerSerializer where TTrigger : ITrigger
Type Parameters
TTrigger
- Inheritance
-
TriggerSerializer<TTrigger>
- Implements
- Derived
- Inherited Members
Remarks
Derive from this for a trigger type of your own. The built-in serializers
(SimpleTriggerSerializer and its siblings) are deliberately public and unsealed:
a trigger deriving from a built-in trigger — HasAdditionalProperties returning
true — pairs with a serializer deriving from the built-in one, overriding
SerializeFields(Utf8JsonWriter, TTrigger, JsonSerializerOptions) / DeserializeFields(TTrigger, JsonElement, JsonSerializerOptions) and calling the base so the
built-in fields keep their stored shape.
Properties
TriggerTypeName
The discriminator written into the payload, and matched against when reading one.
public abstract string TriggerTypeName { get; }
Property Value
Methods
CreateScheduleBuilder(JsonElement, JsonSerializerOptions)
Builds the schedule the payload describes, which the converter then hands to a trigger builder.
public abstract IScheduleBuilder CreateScheduleBuilder(JsonElement jsonElement, JsonSerializerOptions options)
Parameters
jsonElementJsonElementoptionsJsonSerializerOptions
Returns
DeserializeFields(TTrigger, JsonElement, JsonSerializerOptions)
Reads back the fields a schedule builder cannot carry. Does nothing unless a trigger type has any, which most do not.
protected virtual void DeserializeFields(TTrigger trigger, JsonElement jsonElement, JsonSerializerOptions options)
Parameters
triggerTTriggerjsonElementJsonElementoptionsJsonSerializerOptions
SerializeFields(Utf8JsonWriter, TTrigger, JsonSerializerOptions)
Writes the trigger's own fields.
protected abstract void SerializeFields(Utf8JsonWriter writer, TTrigger trigger, JsonSerializerOptions options)
Parameters
writerUtf8JsonWritertriggerTTriggeroptionsJsonSerializerOptions