Class SignalParameterReflection
Reflection helpers shared by the runtime builder and the custom editor for classifying signal
constructor parameters, deciding whether a complex type can be authored from the Inspector, and
selecting/locating the constructor used to build it.
Lives in the runtime assembly (no editor dependencies) so both layers behave identically.
Inherited Members
Namespace: Serenity.EventDispatcher.Infrastructure.Settings
Assembly: Serenity.UnityGlobal.Infrastructure.dll
Syntax
public static class SignalParameterReflection
Fields
MaxDepth
Maximum recursion depth when expanding nested complex parameters.
Declaration
public const int MaxDepth = 6
Field Value
| Type | Description |
|---|---|
| int |
Methods
ClassifyKind(Type)
Classifies a parameter type (after unwrapping nullable) into a leaf kind, or Complex when it is a class/struct authorable through a constructor, or Unsupported otherwise.
Declaration
public static SignalParameterKind ClassifyKind(Type type)
Parameters
| Type | Name | Description |
|---|---|---|
| Type | type | The parameter type to classify. |
Returns
| Type | Description |
|---|---|
| SignalParameterKind | The resolved kind. |
FindConstructor(Type, IReadOnlyList<string>)
Finds the public instance constructor whose parameter types' AssemblyQualifiedNames match
paramTypeAqns in order, or null when none match.
Declaration
public static ConstructorInfo FindConstructor(Type type, IReadOnlyList<string> paramTypeAqns)
Parameters
| Type | Name | Description |
|---|---|---|
| Type | type | The type whose constructors are searched. |
| IReadOnlyList<string> | paramTypeAqns | The ordered parameter type names that identify the overload. |
Returns
| Type | Description |
|---|---|
| ConstructorInfo | The matching constructor, or null. |
GetAuthorableConstructors(Type)
Returns every public instance constructor of type whose parameters are all
authorable, ordered by parameter count ascending. Used to let the user choose how a complex value
is built (e.g. a full field-by-field constructor vs a definition-based one).
Declaration
public static ConstructorInfo[] GetAuthorableConstructors(Type type)
Parameters
| Type | Name | Description |
|---|---|---|
| Type | type | The complex type to inspect. |
Returns
| Type | Description |
|---|---|
| ConstructorInfo[] | The authorable constructors (possibly empty). |
GetIdReferenceType(ParameterInfo)
Returns the definition type a string parameter's id should be picked from — the constructor
PARAMETER'S FoundationIdReferenceAttribute, not the parameter's own declared type —
or null when the parameter carries no such attribute (the first one that names a type, when it is
declared more than once). Shared by the Inspector control
(SignalParameterTreeGui) and FoundationReferenceWalker's read of the same tree, so
authoring and validation agree on which leaves are id references.
Declaration
public static Type GetIdReferenceType(ParameterInfo ownerParam)
Parameters
| Type | Name | Description |
|---|---|---|
| ParameterInfo | ownerParam | The constructor parameter a configured value maps to, or null. |
Returns
| Type | Description |
|---|---|
| Type | The annotated definition type, or null. |
IsAuthorable(Type)
Determines whether a value of the given type can be authored from the Inspector — directly (leaf) or recursively through a constructor (complex). Cycles are treated as non-authorable.
Declaration
public static bool IsAuthorable(Type type)
Parameters
| Type | Name | Description |
|---|---|---|
| Type | type | The type to test. |
Returns
| Type | Description |
|---|---|
| bool | True when the type can be authored. |
IsLeafKind(SignalParameterKind)
True when the kind is a directly editable leaf (not complex and not unsupported).
Declaration
public static bool IsLeafKind(SignalParameterKind kind)
Parameters
| Type | Name | Description |
|---|---|---|
| SignalParameterKind | kind |
Returns
| Type | Description |
|---|---|
| bool |
PrettySignature(ConstructorInfo)
Formats a constructor as (TypeA a, TypeB b) for display.
Declaration
public static string PrettySignature(ConstructorInfo ctor)
Parameters
| Type | Name | Description |
|---|---|---|
| ConstructorInfo | ctor | The constructor to describe. |
Returns
| Type | Description |
|---|---|
| string | A readable signature. |
PrettyTypeName(Type)
Returns a friendly type name for display, using C# aliases for the common primitives
(e.g. float instead of Single), a trailing ? for nullable value types,
and Base<Arg1, Arg2> formatting (arity marker stripped) for generic types.
The single home for this formatting: the project's other per-file "pretty type name" copies
were folded into this one (1.3.1 audit, Wave 4 E6).
Declaration
public static string PrettyTypeName(Type type)
Parameters
| Type | Name | Description |
|---|---|---|
| Type | type | The type to format. |
Returns
| Type | Description |
|---|---|
| string | A readable type name. |
SelectBestConstructor(Type)
Picks the public instance constructor with the most authorable parameters (the most expressive one), or null when no constructor's parameters are all authorable.
Declaration
public static ConstructorInfo SelectBestConstructor(Type type)
Parameters
| Type | Name | Description |
|---|---|---|
| Type | type | The complex type to inspect. |
Returns
| Type | Description |
|---|---|
| ConstructorInfo | The chosen constructor, or null. |
TryUnwrapNullable(Type, out Type)
Returns the underlying type of a Nullable<T>, or the type itself when it is not nullable, and reports whether unwrapping occurred.
Declaration
public static bool TryUnwrapNullable(Type type, out Type underlying)
Parameters
| Type | Name | Description |
|---|---|---|
| Type | type | The type to inspect. |
| Type | underlying | The unwrapped (non-nullable) type. |
Returns
| Type | Description |
|---|---|
| bool | True when |