TypeBuilder Class

Summary

[Editor-Only] Manages the details for building a type in a procedural C# script.
graph BT Type-->Base0["MemberBuilder"] click Base0 "/weaver/api/Weaver.Editor.Procedural.Scripting/MemberBuilder" Base0-->Base1["ElementBuilder"] click Base1 "/weaver/api/Weaver.Editor.Procedural.Scripting/ElementBuilder" Base1-->Base2["Object"] Type-.->Interface0["IElementBuilderGroup"] click Interface0 "/weaver/api/Weaver.Editor.Procedural.Scripting/IElementBuilderGroup" Type["TypeBuilder"] class Type type-node

Syntax

public class TypeBuilder : MemberBuilder, IElementBuilderGroup

Fields

Name Constant Value Summary
DefaultCommentBuilder
The default delegate to use to build the XML comment for this element. Assigned using the return value of Weaver.Editor.Procedural.Scripting.ElementBuilder.GetDefaultCommentBuilder.
Inherited from ElementBuilder
DefaultModifiers
The default access modifiers for this member.
Inherited from MemberBuilder
Elements
The members to build in this type, including Weaver.Editor.Procedural.Scripting.TypeBuilders for any nested types.

Properties

Name Value Summary
AppendBaseType Action<StringBuilder>
Appends the name of the System.Type.BaseType.
AttributeConstructorBuilders Action<StringBuilder>[]
The methods used to build the constructor of each custom attribute for this member.
Inherited from MemberBuilder
Attributes Type[]
The custom attribute types for this member.
Inherited from MemberBuilder
BaseType Type
The System.Type.BaseType of the type being built.
BaseTypeBuilder TypeBuilder
The Weaver.Editor.Procedural.Scripting.TypeBuilder that will build the Weaver.Editor.Procedural.Scripting.TypeBuilder.BaseType.
CommentBuilder Action<StringBuilder>
This delegate is used to append the XML comment for this element. By default it will simply append the Weaver.Editor.Procedural.Scripting.ElementBuilder.NameSource.
Inherited from ElementBuilder
CompilationSymbolIndex int
The index in Weaver.Editor.Procedural.Scripting.ScriptBuilder.CompilationSymbols of the symbol in which this element will be declared, I.E. #if SYMBOL.
Inherited from ElementBuilder
DeclaringType TypeBuilder
The Weaver.Editor.Procedural.Scripting.TypeBuilder which builds the type in which this type is nested (or null if this isn't nested).
ExistingMember MemberInfo
The System.Type of the type with the same type and name as this builder.
ExistingType CachedTypeInfo
The Weaver.Editor.Procedural.Scripting.CachedTypeInfo of the type with the same type and name as this builder.
FullName string
Returns the full name of this element, including its Weaver.Editor.Procedural.Scripting.ElementBuilder.Parent (and any types and namespaces it is nested inside).
Inherited from ElementBuilder
HasExistingMember bool
Returns true if this element is associated with an existing System.Reflection.MemberInfo.
Inherited from MemberBuilder
IsFallbackName bool
Indicates whether the current Weaver.Editor.Procedural.Scripting.ElementBuilder.Name of this element is the primary name derived from the Weaver.Editor.Procedural.Scripting.ElementBuilder.NameSource. A value of false means that there was a name conflict between this element and another, and the Weaver.Editor.Procedural.Scripting.ElementBuilder.Name was re-derived using Weaver.Editor.Procedural.Scripting.ScriptBuilder.GetFallbackMemberName(System.String,System.String).
Inherited from ElementBuilder
MemberType MemberTypes
This builder is a System.Reflection.MemberTypes.TypeInfo if it has no Weaver.Editor.Procedural.Scripting.ElementBuilder.Parent, otherwise it is a System.Reflection.MemberTypes.NestedType.
Modifiers AccessModifiers
The access modifiers of this member.
Inherited from MemberBuilder
Name string
The actual Weaver.Editor.Procedural.Scripting.ElementBuilder.Name of this element. This value is derived from Weaver.Editor.Procedural.Scripting.ElementBuilder.NameSource during Weaver.Editor.Procedural.Scripting.ElementBuilder.PrepareToBuild(System.Boolean,System.Boolean@).
Inherited from ElementBuilder
NameSource string
The source string which will be used to determine the actual Weaver.Editor.Procedural.Scripting.ElementBuilder.Name of this element.
Inherited from ElementBuilder
Namespace string
The name of the Weaver.Editor.Procedural.Scripting.NamespaceBuilder containing this type (or null if there isn't one).
Inherited from ElementBuilder
ObsoleteMembers List<MemberInfo>
During Weaver.Editor.Procedural.Scripting.TypeBuilder.PrepareToBuild(System.Boolean,System.Boolean@) this type will compare all members in the existing System.Type with the Weaver.Editor.Procedural.Scripting.TypeBuilder.Elements to be built, and any that don't match up are kept in this list so they can be re-implemented as stubs and marked with the [System.ObsoleteAttribute] in order to avoid causing compile errors when members are removed or renamed when the script it rebuilt.

This list will be null if no obsolete members are found or if the `retainObsoleteMembers` parameter in Weaver.Editor.Procedural.Scripting.TypeBuilder.PrepareToBuild(System.Boolean,System.Boolean@) is false.
Parent IElementBuilderGroup
The builder of the type in which this element will be declared.
Inherited from ElementBuilder
RegionIndex int
The index in Weaver.Editor.Procedural.Scripting.ScriptBuilder.Regions of the region in which this element will be declared, I.E. #region Region Name.
Inherited from ElementBuilder
ScriptBuilder ScriptBuilder
The Weaver.Editor.Procedural.Scripting.ScriptBuilder in which this element is currently being used.
Inherited from ElementBuilder

Methods

Name Value Summary
AddConstructor(AppendFunction) ConstructorBuilder
Get a Weaver.Editor.Procedural.Scripting.ConstructorBuilder from the object pool and initialize it with the specified parameters as a member of this type.
AddConstructor(ParameterBuilder[], AppendFunction) ConstructorBuilder
Get a Weaver.Editor.Procedural.Scripting.ConstructorBuilder from the object pool and initialize it with the specified parameters as a member of this type.
AddField(string, Type) FieldBuilder
Get a Weaver.Editor.Procedural.Scripting.FieldBuilder from the object pool and initialize it with the specified parameters as a member of this type.
AddField(string, TypeName) FieldBuilder
Get a Weaver.Editor.Procedural.Scripting.FieldBuilder from the object pool and initialize it with the specified parameters as a member of this type.
AddField<T>(string, T) FieldBuilder
Get a Weaver.Editor.Procedural.Scripting.FieldBuilder from the object pool and initialize it with the specified parameters as a member of this type.
AddMember<T>(T) T
Adds the specified `member` to the Weaver.Editor.Procedural.Scripting.TypeBuilder.Elements list and returns it.
AddMethod(string, AppendFunction) MethodBuilder
Get a Weaver.Editor.Procedural.Scripting.MethodBuilder from the object pool and initialize it with the specified parameters as a member of this type.
AddMethod(string, TypeName, AppendFunction) MethodBuilder
Get a Weaver.Editor.Procedural.Scripting.MethodBuilder from the object pool and initialize it with the specified parameters as a member of this type.
AddMethod(string, TypeName, ParameterBuilder[], AppendFunction) MethodBuilder
Get a Weaver.Editor.Procedural.Scripting.MethodBuilder from the object pool and initialize it with the specified parameters as a member of this type.
AddNestedType(string) TypeBuilder
Get a Weaver.Editor.Procedural.Scripting.TypeBuilder from the object pool and initialize it with the specified parameters as a member of this type.
AddProperty(string, TypeName, AppendFunction, AppendFunction) PropertyBuilder
Get a Weaver.Editor.Procedural.Scripting.PropertyBuilder from the object pool and initialize it with the specified parameters as a member of this type.
AppendDescription(StringBuilder, int) void
Appends a description of this type and its Weaver.Editor.Procedural.Scripting.TypeBuilder.Elements.
AppendFullName(StringBuilder) void
Appends the full name of this element, including its Weaver.Editor.Procedural.Scripting.ElementBuilder.Parent (and any types and namespaces it is nested inside).
Inherited from ElementBuilder
AppendHeader(StringBuilder, int) void
Appends a C# XML comment using the Weaver.Editor.Procedural.Scripting.ElementBuilder.CommentBuilder followed by any Weaver.Editor.Procedural.Scripting.MemberBuilder.Attributes.
Inherited from MemberBuilder
AppendScript(StringBuilder, int) void
Appends the declaration of this type in C# code to the specified `text`.
DetermineMemberName(ScriptBuilder) void
Uses the specified Weaver.Editor.Procedural.Scripting.ScriptBuilder.GetMemberName(System.String,System.String,System.Boolean@) to determine the Weaver.Editor.Procedural.Scripting.ElementBuilder.Name of this element.
Inherited from ElementBuilder
Get(IElementBuilderGroup, string) TypeBuilder
Get a Weaver.Editor.Procedural.Scripting.TypeBuilder from the object pool and initialize it with the specified parameters.
static
Get(IElementBuilderGroup, string, CachedTypeInfo) TypeBuilder
Get a Weaver.Editor.Procedural.Scripting.TypeBuilder from the object pool and initialize it with the specified parameters.
static
Get(IElementBuilderGroup, string, Type) TypeBuilder
Get a Weaver.Editor.Procedural.Scripting.TypeBuilder from the object pool and initialize it with the specified parameters.
static
Get(ScriptBuilder, string) TypeBuilder
Get a Weaver.Editor.Procedural.Scripting.TypeBuilder from the object pool and initialize it with the specified parameters.
static
Get(TypeBuilder, string) TypeBuilder
Get a Weaver.Editor.Procedural.Scripting.TypeBuilder from the object pool and initialize it with the specified parameters.
static
GetDefaultCommentBuilder() Action<StringBuilder>
Returns the default method to use to build XML comments for this element. Called once by the constructor.
Inherited from ElementBuilder
GetDescription() string
Gets a description of this element by calling Weaver.Editor.Procedural.Scripting.ElementBuilder.ToString on it and any sub-members.
Inherited from ElementBuilder
GetOrAddNestedTypesForDirectories(string) TypeBuilder
Creates (if necessary) and returns a Weaver.Editor.Procedural.Scripting.TypeBuilder such that each directory in the specified `filePath` corresponds to a nested type.
GetOrAddNestedTypesForDirectories(Substring) TypeBuilder
Creates (if necessary) and returns a Weaver.Editor.Procedural.Scripting.TypeBuilder such that each directory in the specified `filePath` corresponds to a nested type.
GetOrAddNestedTypesForDirectories(Substring, int) TypeBuilder
Creates (if necessary) and returns a Weaver.Editor.Procedural.Scripting.TypeBuilder such that each directory in the specified `filePath` corresponds to a nested type.
Initialize(IElementBuilderGroup, string) void
Assigns the specified parameters to this element and determines the Weaver.Editor.Procedural.Scripting.ElementBuilder.Name.
Inherited from ElementBuilder
IsExistingMember(MemberInfo, bool) bool
Checks if the Weaver.Editor.Procedural.Scripting.ElementBuilder.Name and Weaver.Editor.Procedural.Scripting.MemberBuilder.Modifiers match the `existingMember`.

If the member matches, this method returns true and the member can be accessed via Weaver.Editor.Procedural.Scripting.TypeBuilder.ExistingType.
ReleaseElementsToPool() void
Releases all elements currently in this type back to their respective pools.
ReleaseToPool() void
Resets this element and adds it to its object pool to be reused later.
Reset() void
Reset all of the fields and properties of this member to their default values.
SetAttributeConstructorBuilders(Action<StringBuilder>[]) void
Sets the Weaver.Editor.Procedural.Scripting.MemberBuilder.AttributeConstructorBuilders array.
Inherited from MemberBuilder
SetAttributes(Type[]) void
Sets the Weaver.Editor.Procedural.Scripting.MemberBuilder.Attributes array.
Inherited from MemberBuilder
SetName(string) void
Sets the Weaver.Editor.Procedural.Scripting.ElementBuilder.Name and Weaver.Editor.Procedural.Scripting.ElementBuilder.NameSource.
Inherited from ElementBuilder
ToString() string
Returns a summary of this element including its type, Weaver.Editor.Procedural.Scripting.ElementBuilder.NameSource, Weaver.Editor.Procedural.Scripting.ElementBuilder.Name, and Weaver.Editor.Procedural.Scripting.ElementBuilder.FullName.
Inherited from ElementBuilder