Table of Contents

Class BaseProperties

Namespace
Solace.SchemaRegistry.Serdes.Core.Resolver
Assembly
Solace.SchemaRegistry.Serdes.Core.dll

Abstract base class for configuration properties used in schema resolution operations. This class provides common functionality for managing configuration key-value pairs in a thread-safe, immutable manner for derived property classes.

public abstract class BaseProperties
Inheritance
BaseProperties
Derived
Inherited Members

Remarks

BaseProperties serves as the foundation for configuration management across schema registry operations. It encapsulates a configuration dictionary and provides controlled access through a copy-on-read pattern to ensure immutability from the consumer's perspective.

Derived classes should extend this class to provide typed access to specific configuration properties while maintaining the underlying dictionary structure for flexibility.

Constructors

BaseProperties()

Initializes a new instance of the BaseProperties class with an empty configuration.

protected BaseProperties()

Remarks

This constructor creates a new BaseProperties instance with no initial configuration. Derived classes should populate the configuration dictionary as needed during initialization.

Fields

config

The internal configuration dictionary that stores property key-value pairs.

protected IDictionary<string, object> config

Field Value

IDictionary<string, object>

Remarks

This field is protected to allow derived classes to modify the configuration while preventing direct access from external consumers.

Properties

Configuration

Gets a read-only copy of the current configuration dictionary.

public IDictionary<string, object> Configuration { get; }

Property Value

IDictionary<string, object>

A new IDictionary<TKey, TValue> containing a copy of all configuration key-value pairs. Returns an empty dictionary if no configuration has been set.

Remarks

This property implements a copy-on-read pattern to ensure that modifications to the returned dictionary do not affect the internal configuration state. Each access creates a new dictionary instance with a shallow copy of the current configuration entries. While the dictionary structure is copied, the actual objects stored as values are not cloned.

Use this property when you need to examine or iterate over configuration values without risk of inadvertent modification to the underlying configuration state.

Methods

GetBoolean(string)

Gets a required configuration value of type bool.

protected bool GetBoolean(string key)

Parameters

key string

The configuration key.

Returns

bool

The configuration value as a boolean.

Exceptions

ArgumentException

Thrown when the key is not found, value is null, or value cannot be cast/converted to bool.

GetEnumHashSet<T>(string)

Gets a required configuration value as a HashSet of enum values of type T. Supports single enum values, string representations, or HashSet of enum values.

protected HashSet<T> GetEnumHashSet<T>(string key) where T : struct, Enum

Parameters

key string

The configuration key.

Returns

HashSet<T>

A HashSet containing the enum values.

Type Parameters

T

The enum type.

Remarks

For multiple values, only HashSet<T> collections are supported.

Exceptions

ArgumentException

Thrown when the key is not found, value is null, value is an empty collection, value is not a HashSet, or values cannot be converted to the enum type.

GetInt(string)

Gets a required configuration value of type int.

protected int GetInt(string key)

Parameters

key string

The configuration key.

Returns

int

The configuration value as an integer.

Exceptions

ArgumentException

Thrown when the key is not found, value is null, value cannot be cast/converted to int, or value is out of range.

GetLongNotNull(string)

Gets a required configuration value as a long integer. Supports long values directly, or numeric and string values that can be converted to long.

protected long GetLongNotNull(string key)

Parameters

key string

The configuration key.

Returns

long

The configuration value as a long integer.

Exceptions

ArgumentException

Thrown when the key is not found, value is null, value is not a supported numeric type, string value cannot be parsed as a long, or value exceeds the valid range for a long.

GetLongPositive(string)

Gets a required configuration value of type long and validates it is greater than 0.

protected long GetLongPositive(string key)

Parameters

key string

The configuration key.

Returns

long

The configuration value as a long integer that is greater than 0.

Exceptions

ArgumentException

Thrown when the key is not found, value is null, value is not a supported numeric type, string value cannot be parsed as a long, value exceeds the valid range for a long, or value is less than or equal to 0.

GetString(string)

Gets a required configuration value of type string.

protected string GetString(string key)

Parameters

key string

The configuration key.

Returns

string

The configuration value cast to type T.

Exceptions

InvalidOperationException

Thrown when the key is not found, value is null, or value cannot be cast to type string.

GetStringNullable(string)

Gets a required configuration value of type string or null.

protected string GetStringNullable(string key)

Parameters

key string

The configuration key.

Returns

string

The configuration value cast to type T.

Exceptions

ArgumentException

Thrown when the key is not found, value is null, or value cannot be cast to type string.

GetTimeSpanNonNegative(string)

Gets a required configuration value as a non-negative TimeSpan. Supports TimeSpan objects directly, or numeric and string values interpreted as milliseconds. Numeric and string values must be representable as a 64-bit signed integer (long).

protected TimeSpan GetTimeSpanNonNegative(string key)

Parameters

key string

The configuration key.

Returns

TimeSpan

A TimeSpan representing the duration.

Exceptions

ArgumentException

Thrown when the key is not found, value is null, value is negative, value is not a supported type, string value cannot be parsed as a number, or value exceeds the valid range for a long.

GetType(string)

Gets a required configuration value as a Type. Supports both Type objects and string representations of fully qualified type names.

protected Type GetType(string key)

Parameters

key string

The configuration key.

Returns

Type

The Type value associated with the key.

Exceptions

ArgumentException

Thrown when the key is not found, value is null, value is not a Type or string, or the string value cannot be resolved to a Type.