ClassType

Description

sealed class Tinman.Core.Config.ClassType

Derived from

ConfigType abstract

Config property type: composite class type (supporting simple inheritance).

Class fields (declared ones and inherited ones) are grouped into required, optional and virtual fields. The order of fields in each group is the same as the order in which the fields has been added to the class type during building (see ClassTypeBuilder):

  • Required fields: [0..a[

  • Optional fields: [a..b[

  • Virtual fields: [b..c[

where a is the count of required fields (see FieldCountRequired), b is the count of regular fields (see FieldCountRegular), b-a is the count of optional fields, b-c is the number of virtual fields and c is the field count (see FieldCount). A subclass may declare a required or optional field using the same name as an inherited virtual field; the inherited field is then overridden and does no longer count for the virtual fields group.

This type should not be used as the target for type casting expressions, see ConfigType.IsClass for details.

Public / Constants

Obj


[ShutdownSurvive]
public static readonly attribute Obj → (ClassType)

Object type.

This is the implicit super class of all class types.

Public / Constructors

Builder


public static method Builder → (2)

name in : string

[not-empty]
The class name.

module in : TinmanModule

[not-null]
The module that owns the new class type.

returns → ClassTypeBuilder

The builder object.

Returns a builder for creating a new class type.

Of


public static method Of → (1)

type in : ConfigType

The type or null.

returns → ClassType

The result of ConfigType.AsClassNull or null if type in is null.

Helper that calls ConfigType.AsClassNull on the given type in.

Public / Methods

Configure​Delegate


[OwnerReturn]
public method ConfigureDelegate → (1)

value in : ConfigValue

[not-null]
The config value.

returns → IConfigurable

The configured object.

Configures an object from the given config value, using this class type as base.

The use of this class types Configurator is prohibited.

ConfigException

If value in specifies malformed configuration data.

IOException

If a temporary I/O error has occurred; the same call might succeed later.

ValidatingException

If the given config value is invalid (see IValidatable.Validate).

Get​Field

2 overloads


public method GetField1 → (2)

name in : string

[not-null]
The field name.

includeVirtual opt : bool = false

Return virtual fields?

returns → ConfigMember

The ConfigMember object.

Returns a field of this class type by its name.

ConfigException

If no field named name in exists in this type.


public method GetField2 → (1)

idx in : int32

[0..ClassType.FieldCount-1]
Index of field to return.

returns → ConfigMember

The ConfigMember object.

Returns a field of this class type.

Get​Field​Null


public method GetFieldNull → (2)

name in : string

[not-null]
The field name.

includeVirtual opt : bool = false

Return virtual fields?

returns → ConfigMember

The ConfigMember object or null.

Returns a field of this class type by its name.

Get​Sub​Class


public method GetSubClass → (1)

index in : int32

[0..ClassType.SubClassCount-1]
Index of subclass to return.

returns → ClassType

The subclass.

Returns a subclass of this class.

Public / Attributes

Configurator


public attribute Configurator → (get)

value : IConfiguratorObject

The object configurator or null.

Optional object configurator for this config type.

Field​Count


public attribute FieldCount → (get)

value : int32

[>=0]
The number of fields.

Returns the number of fields this class type has (including inherited ones).

Class fields (declared ones and inherited ones) are grouped into required, optional and virtual fields. The order of fields in each group is the same as the order in which the fields has been added to the class type during building (see ClassTypeBuilder):

  1. Required fields: [0..a[

  2. Optional fields: [a..b[

  3. Virtual fields: [b..c[

where a is the count of required fields, b-a is the count of optional fields, b-c is the number of virtual fields and c is the field count (see FieldCount). A subclass may declare a required or optional field using the same name as an inherited virtual field; the inherited field is then overridden and does no longer count for the virtual fields group.

Field​Count​Regular


public attribute FieldCountRegular → (get)

value : int32

[>=0]
The number of required class fields.

The number of regular (required and optional) class fields.

Field​Count​Required


public attribute FieldCountRequired → (get)

value : int32

[>=0]
The number of required class fields.

The number of required class fields.

Has​Virtual


public attribute HasVirtual → (get)

value : bool

true if this class has virtual fields, false if not.

Does this class have virtual fields?

Sub​Class​Count


public attribute SubClassCount → (get)

value : int32

[>=0]
The number of subclasses.

Returns the number of classes that are derived from this class.

Super​Class


public attribute SuperClass → (get)

value : ClassType

The super class type or null.

The super class of this class type.