Lean  $LEAN_TAG$
QuantConnect.Util.TypeChangeJsonConverter< T, TResult > Class Template Referenceabstract

Provides a base class for a JsonConverter that serializes a an input type as some other output type More...

Inheritance diagram for QuantConnect.Util.TypeChangeJsonConverter< T, TResult >:
[legend]

Public Member Functions

override object ReadJson (JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer)
 Reads the JSON representation of the object. More...
 
override void WriteJson (JsonWriter writer, object value, JsonSerializer serializer)
 Writes the JSON representation of the object. More...
 
override bool CanConvert (Type objectType)
 Determines whether this instance can convert the specified object type. More...
 

Protected Member Functions

virtual T Create (Type type, JToken token)
 Creates an instance of the un-projected type to be deserialized More...
 
abstract TResult Convert (T value)
 Convert the input value to a value to be serialized More...
 
abstract T Convert (TResult value)
 Converts the input value to be deserialized More...
 

Protected Attributes

virtual bool PopulateProperties => true
 True will populate TResult object returned by Convert(TResult) with json properties More...
 

Detailed Description

Provides a base class for a JsonConverter that serializes a an input type as some other output type

Template Parameters
TThe type to be serialized
TResultThe output serialized type

Definition at line 29 of file TypeChangeJsonConverter.cs.

Member Function Documentation

◆ ReadJson()

override object QuantConnect.Util.TypeChangeJsonConverter< T, TResult >.ReadJson ( JsonReader  reader,
Type  objectType,
object  existingValue,
JsonSerializer  serializer 
)

Reads the JSON representation of the object.

Parameters
readerThe T:Newtonsoft.Json.JsonReader to read from.
objectTypeType of the object.
existingValueThe existing value of object being read.
serializerThe calling serializer.
Returns
The object value.

Definition at line 46 of file TypeChangeJsonConverter.cs.

◆ WriteJson()

override void QuantConnect.Util.TypeChangeJsonConverter< T, TResult >.WriteJson ( JsonWriter  writer,
object  value,
JsonSerializer  serializer 
)

Writes the JSON representation of the object.

Parameters
writerThe T:Newtonsoft.Json.JsonWriter to write to.
valueThe value.
serializerThe calling serializer.

Definition at line 61 of file TypeChangeJsonConverter.cs.

◆ CanConvert()

override bool QuantConnect.Util.TypeChangeJsonConverter< T, TResult >.CanConvert ( Type  objectType)

Determines whether this instance can convert the specified object type.

Parameters
objectTypeType of the object.
Returns
true if this instance can convert the specified object type; otherwise, false.

Definition at line 76 of file TypeChangeJsonConverter.cs.

◆ Create()

virtual T QuantConnect.Util.TypeChangeJsonConverter< T, TResult >.Create ( Type  type,
JToken  token 
)
protectedvirtual

Creates an instance of the un-projected type to be deserialized

Parameters
typeThe input object type, this is the data held in the token
tokenThe input data to be converted into a T
Returns
A new instance of T that is to be serialized using default rules

Reimplemented in QuantConnect.Util.MarketHoursDatabaseJsonConverter.

Definition at line 87 of file TypeChangeJsonConverter.cs.

Here is the caller graph for this function:

◆ Convert() [1/2]

abstract TResult QuantConnect.Util.TypeChangeJsonConverter< T, TResult >.Convert ( value)
protectedpure virtual

Convert the input value to a value to be serialized

Parameters
valueThe input value to be converted before serialziation
Returns
A new instance of TResult that is to be serialzied
Here is the caller graph for this function:

◆ Convert() [2/2]

abstract T QuantConnect.Util.TypeChangeJsonConverter< T, TResult >.Convert ( TResult  value)
protectedpure virtual

Converts the input value to be deserialized

Parameters
valueThe deserialized value that needs to be converted to T
Returns
The converted value

Member Data Documentation

◆ PopulateProperties

virtual bool QuantConnect.Util.TypeChangeJsonConverter< T, TResult >.PopulateProperties => true
protected

True will populate TResult object returned by Convert(TResult) with json properties

Definition at line 37 of file TypeChangeJsonConverter.cs.


The documentation for this class was generated from the following file: