CodecAuto


Object Hierarchy:

Object hierarchy for CodecAuto

Description:


public sealed class CodecAuto : ValueCodec

Explicit, target-aware scalar conversion for irregular input.

Return `new CodecAuto (property.value_type)` from CodecProvider.get_property_codec for a single property, or use Deser.create_auto_codec for a typed root or collection element. Standard property codecs remain strict. Only scalar values are converted; overflow and loss of numeric precision raise Deser.Error.RANGE.

class Record : Deser.DataObject {
public int count { get; set; }
public override Deser.ValueCodec get_property_codec (GLib.ParamSpec property)
throws Deser.Error {
if (property.name == "count") return new Deser.CodecAuto (property.value_type);
return base.get_property_codec (property);
}
}
var record = new Deser.JsonWorker ("{\"count\":\"42\"}").deserialize_object<Record> ();
var array_codec = new Deser.GenericArrayCodec<int> (Deser.create_auto_codec<int> ());


Namespace: Deser
Package: libdeser-0.1

Content:

Properties:

Creation methods:

Methods:

Inherited Members:

All known members inherited from class Deser.ValueCodec