C# Client Library
A C# Client Library for the AnalyzeRe REST API
Loading...
Searching...
No Matches
AnalyzeReTesting.Utilities.Reflection.RecursionContext Class Reference

Used to keep track of the recursive random generation process for objects and their attributes. When an object or its properties are being randomly generated, the recursion context indicates what the parent object (if any) is. When a property to generate has additional nested properties that must also be randomized, the recursion context will point back to the original root object. More...

Public Member Functions

 RecursionContext (Type objectType)
 
 RecursionContext (Type objectType, int depth)
 
 RecursionContext (Type objectType, RecursionContext prior)
 
bool HasParent (Func< RecursionContext, bool > condition=null)
 Test whether this RecursionContext has a parent. If a condition is given, returns true only if the parent matches the condition.
 
void LogIndented (string log)
 Outputs the log with all newlines indented by an additional amount for every level of recursion.
 
bool MatchesCondition (Func< RecursionContext, bool > condition)
 Test whether this RecursionContext or any prior matches the condition.
 
override string ToString ()
 

Protected Member Functions

 RecursionContext (Type objectType, int depth, RecursionContext prior)
 

Properties

int Depth [get]
 The number of times we have recursed so far.
 
RecursionContext Prior [get]
 The previous recursion context.
 
Type Type [get]
 The type of resource being generated.
 

Detailed Description

Used to keep track of the recursive random generation process for objects and their attributes. When an object or its properties are being randomly generated, the recursion context indicates what the parent object (if any) is. When a property to generate has additional nested properties that must also be randomized, the recursion context will point back to the original root object.

Currently, this is primarily required to tell the difference between a Nested layer being generated as a root object, or as an embedded layer definition within a layer_view.

This is also used to track how deeply the routine has recursed so far and change random generation behaviour to reduce the chance of recursing further.

Definition at line 118 of file Reflection.cs.

Constructor & Destructor Documentation

◆ RecursionContext() [1/4]

AnalyzeReTesting.Utilities.Reflection.RecursionContext.RecursionContext ( Type  objectType,
int  depth,
RecursionContext  prior 
)
inlineprotected

Definition at line 127 of file Reflection.cs.

◆ RecursionContext() [2/4]

AnalyzeReTesting.Utilities.Reflection.RecursionContext.RecursionContext ( Type  objectType)
inline

Definition at line 134 of file Reflection.cs.

◆ RecursionContext() [3/4]

AnalyzeReTesting.Utilities.Reflection.RecursionContext.RecursionContext ( Type  objectType,
int  depth 
)
inline

Definition at line 136 of file Reflection.cs.

◆ RecursionContext() [4/4]

AnalyzeReTesting.Utilities.Reflection.RecursionContext.RecursionContext ( Type  objectType,
RecursionContext  prior 
)
inline

Definition at line 138 of file Reflection.cs.

Member Function Documentation

◆ HasParent()

bool AnalyzeReTesting.Utilities.Reflection.RecursionContext.HasParent ( Func< RecursionContext, bool condition = null)
inline

Test whether this RecursionContext has a parent. If a condition is given, returns true only if the parent matches the condition.

Definition at line 147 of file Reflection.cs.

◆ LogIndented()

void AnalyzeReTesting.Utilities.Reflection.RecursionContext.LogIndented ( string  log)
inline

Outputs the log with all newlines indented by an additional amount for every level of recursion.

Definition at line 156 of file Reflection.cs.

◆ MatchesCondition()

bool AnalyzeReTesting.Utilities.Reflection.RecursionContext.MatchesCondition ( Func< RecursionContext, bool condition)

Test whether this RecursionContext or any prior matches the condition.

◆ ToString()

override string AnalyzeReTesting.Utilities.Reflection.RecursionContext.ToString ( )

Property Documentation

◆ Depth

int AnalyzeReTesting.Utilities.Reflection.RecursionContext.Depth
get

The number of times we have recursed so far.

Definition at line 123 of file Reflection.cs.

◆ Prior

RecursionContext AnalyzeReTesting.Utilities.Reflection.RecursionContext.Prior
get

The previous recursion context.

Definition at line 125 of file Reflection.cs.

◆ Type

Type AnalyzeReTesting.Utilities.Reflection.RecursionContext.Type
get

The type of resource being generated.

Definition at line 121 of file Reflection.cs.


The documentation for this class was generated from the following file: