Exemplo n.º 1
0
 /// <summary>
 /// To convert a JSON string into an object
 /// </summary>
 /// <param name="reader">JSON reader</param>
 /// <param name="objectType">Object type</param>
 /// <param name="existingValue">Existing value</param>
 /// <param name="serializer">JSON Serializer</param>
 /// <returns>The object converted from the JSON string</returns>
 public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer)
 {
     if (reader.TokenType != JsonToken.Null)
     {
         return(Quadrilateral.FromJson(JObject.Load(reader).ToString(Formatting.None)));
     }
     return(null);
 }
Exemplo n.º 2
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Shape" /> class.
 /// </summary>
 /// <param name="quadrilateral">quadrilateral</param>
 /// <param name="quadrilateralType">quadrilateralType (required)</param>
 public Shape(Quadrilateral quadrilateral, string quadrilateralType)
 {
     if (quadrilateralType == null)
     {
         throw new ArgumentNullException("quadrilateralType is a required property for Shape and cannot be null.");
     }
     Quadrilateral     = quadrilateral;
     QuadrilateralType = quadrilateralType;
 }
Exemplo n.º 3
0
 /// <summary>
 /// Initializes a new instance of the <see cref="NullableShape" /> class
 /// with the <see cref="Quadrilateral" /> class
 /// </summary>
 /// <param name="actualInstance">An instance of Quadrilateral.</param>
 public NullableShape(Quadrilateral actualInstance)
 {
     this.IsNullable     = true;
     this.SchemaType     = "oneOf";
     this.ActualInstance = actualInstance;
 }
Exemplo n.º 4
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Shape" /> class
 /// with the <see cref="Quadrilateral" /> class
 /// </summary>
 /// <param name="actualInstance">An instance of Quadrilateral.</param>
 public Shape(Quadrilateral actualInstance)
 {
     this.IsNullable     = false;
     this.SchemaType     = "oneOf";
     this.ActualInstance = actualInstance ?? throw new ArgumentException("Invalid instance found. Must not be null.");
 }
Exemplo n.º 5
0
 /// <summary>
 /// Initializes a new instance of the <see cref="NullableShape" /> class.
 /// </summary>
 /// <param name="quadrilateral">quadrilateral</param>
 public NullableShape(Quadrilateral quadrilateral)
 {
     Quadrilateral = quadrilateral;
 }