C# Client Library
A C# Client Library for the AnalyzeRe REST API
Loading...
Searching...
No Matches
AnalyzeRe.JsonConverters.ReferenceConverter Class Reference

Deserializes AnalyzeRe API Reference objects to a new instance of a the target generic Reference type, and Serializes Reference objects too. More...

Public Types

enum  ReferenceSerializationMethod { UseReferencesOnly , ExpandIfResolved , ExpandReferenceValues }
 The SerializationMethod to use when serializing references. More...
 

Public Member Functions

 ReferenceConverter (ReferenceSerializationMethod serializationMethod=ReferenceSerializationMethod.UseReferencesOnly)
 Initializes the ReferenceConverter using the specified SerializationMethod.
 
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 a Reference object based on the configured SerializationMethod controlling whether/when references are resolved.
 

Properties

ReferenceSerializationMethod SerializationMethod [get, set]
 Used during serialization to determine whether references should be expanded in JSON.
 

Detailed Description

Deserializes AnalyzeRe API Reference objects to a new instance of a the target generic Reference type, and Serializes Reference objects too.

Definition at line 15 of file ReferenceConverter.cs.

Inheritance diagram for AnalyzeRe.JsonConverters.ReferenceConverter:

Member Enumeration Documentation

◆ ReferenceSerializationMethod

The SerializationMethod to use when serializing references.

Enumerator
UseReferencesOnly 

Use the JSON representation of a reference to the object.

ExpandIfResolved 

Serialize the referenced object only if it has already been retrieved.

ExpandReferenceValues 

Retrieve the referenced object and serialize it in place of the reference.

Definition at line 21 of file ReferenceConverter.cs.

Constructor & Destructor Documentation

◆ ReferenceConverter()

AnalyzeRe.JsonConverters.ReferenceConverter.ReferenceConverter ( ReferenceSerializationMethod  serializationMethod = ReferenceSerializationMethod::UseReferencesOnly)
inline

Initializes the ReferenceConverter using the specified SerializationMethod.

Parameters
serializationMethodThe SerializationMethod to use when serializing references.

Definition at line 50 of file ReferenceConverter.cs.

Member Function Documentation

◆ CanConvert()

override bool AnalyzeRe.JsonConverters.ReferenceConverter.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 77 of file ReferenceConverter.cs.

◆ ReadJson()

override object AnalyzeRe.JsonConverters.ReferenceConverter.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 108 of file ReferenceConverter.cs.

◆ WriteJson()

override void AnalyzeRe.JsonConverters.ReferenceConverter.WriteJson ( JsonWriter  writer,
object  value,
JsonSerializer  serializer 
)
inline

Serializes a Reference object based on the configured SerializationMethod controlling whether/when references are resolved.

Definition at line 215 of file ReferenceConverter.cs.

Property Documentation

◆ SerializationMethod

ReferenceSerializationMethod AnalyzeRe.JsonConverters.ReferenceConverter.SerializationMethod
getset

Used during serialization to determine whether references should be expanded in JSON.

Definition at line 40 of file ReferenceConverter.cs.


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