C# Client Library
A C# Client Library for the AnalyzeRe REST API
Loading...
Searching...
No Matches
AnalyzeRe.JsonConverters.JsonCreationConverter< T > Class Template Referenceabstract

Json converter helper class. More...

Public Member Functions

override bool CanConvert (Type objectType)
 Determines if this converter is designed for deserialization to objects of the specified type.
 
override object ReadJson (JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer)
 Parses the json to the specified type.
 
override void WriteJson (JsonWriter writer, object value, JsonSerializer serializer)
 Serializes to the specified type.
 

Static Public Member Functions

static JsonReader CopyReaderForObject (JsonReader reader, JObject jObject)
 Creates a new reader for the specified jObject by copying the settings from an existing reader.
 

Protected Member Functions

Create (Type objectType, JObject jObject)
 Create an instance of objectType, based properties in the JSON object.
 

Detailed Description

Json converter helper class.

Base Generic JSON Converter that can help quickly define converters for specific types by automatically generating the CanConvert, ReadJson, and WriteJson methods, requiring the implementer only to define a strongly typed Create method.

Definition at line 13 of file JsonCreationConverter[T].cs.

Inheritance diagram for AnalyzeRe.JsonConverters.JsonCreationConverter< T >:
AnalyzeRe.JsonConverters.DerivedResourceCreationConverter< T >

Member Function Documentation

◆ CanConvert()

override bool AnalyzeRe.JsonConverters.JsonCreationConverter< T >.CanConvert ( Type  objectType)
inline

Determines if this converter is designed for deserialization to objects of the specified type.

Parameters
objectTypeThe target type for deserialization.
Returns
True if the type is supported.

Definition at line 21 of file JsonCreationConverter[T].cs.

◆ CopyReaderForObject()

static JsonReader AnalyzeRe.JsonConverters.JsonCreationConverter< T >.CopyReaderForObject ( JsonReader  reader,
JObject  jObject 
)
inlinestatic

Creates a new reader for the specified jObject by copying the settings from an existing reader.

Parameters
readerThe reader whose settings should be copied.
jObjectThe jObject to create a new reader for.
Returns
The new disposable reader.

Definition at line 14 of file JsonCreationConverter.cs.

◆ Create()

T AnalyzeRe.JsonConverters.JsonCreationConverter< T >.Create ( Type  objectType,
JObject  jObject 
)
abstractprotected

Create an instance of objectType, based properties in the JSON object.

Parameters
objectTypeThe type of object expected.
jObjectThe contents of JSON object that will be deserialized.

◆ ReadJson()

override object AnalyzeRe.JsonConverters.JsonCreationConverter< T >.ReadJson ( JsonReader  reader,
Type  objectType,
object  existingValue,
JsonSerializer  serializer 
)
inline

Parses the json to the specified type.

Parameters
readerNewtonsoft.Json.JsonReader
objectTypeTarget type.
existingValueIgnored
serializerNewtonsoft.Json.JsonSerializer to use.
Returns
Deserialized Object

Definition at line 34 of file JsonCreationConverter[T].cs.

◆ WriteJson()

override void AnalyzeRe.JsonConverters.JsonCreationConverter< T >.WriteJson ( JsonWriter  writer,
object  value,
JsonSerializer  serializer 
)
inline

Serializes to the specified type.

Parameters
writerNewtonsoft.Json.JsonWriter
valueThe object to serialize.
serializerThe Newtonsoft.Json.JsonSerializer to use.

Definition at line 65 of file JsonCreationConverter[T].cs.


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