PeterO.Cbor.CBORTypeMapper

PeterO.Cbor.CBORTypeMapper

public sealed class CBORTypeMapper

Holds converters to customize the serialization and deserialization behavior of CBORObject.FromObject and CBORObject#ToObject , as well as type filters for ToObject .

Member Summary

CBORTypeMapper Constructor

public CBORTypeMapper();

Initializes a new instance of the PeterO.Cbor.CBORTypeMapper class.

AddConverter

public PeterO.Cbor.CBORTypeMapper AddConverter<T>(
    System.Type type,
    PeterO.Cbor.ICBORConverter<T> converter);

Registers an object that converts objects of a given type to CBOR objects (called a CBOR converter). If the CBOR converter converts to and from CBOR objects, it should implement the ICBORToFromConverter interface and provide ToCBORObject and FromCBORObject methods. If the CBOR converter only supports converting to (not from) CBOR objects, it should implement the ICBORConverter interface and provide a ToCBORObject method.

Parameters:

Return Value:

This object.

Exceptions:

AddTypeName

public PeterO.Cbor.CBORTypeMapper AddTypeName(
    string name);

Adds the fully qualified name of a Java or.NET type for use in type matching.

Parameters:

Return Value:

This object.

Exceptions:

AddTypePrefix

public PeterO.Cbor.CBORTypeMapper AddTypePrefix(
    string prefix);

Adds a prefix of a Java or.NET type for use in type matching. A type matches a prefix if its fully qualified name is or begins with that prefix, using codepoint-by-codepoint (case-sensitive) matching.

Parameters:

Return Value:

This object.

Exceptions:

FilterTypeName

public bool FilterTypeName(
    string typeName);

Returns whether the given Java or.NET type name fits the filters given in this mapper.

Parameters:

Return Value:

Either true if the given Java or.NET type name fits the filters given in this mapper, or false otherwise.

Back to CBOR start page.