Class Meta2ClassesTransformation.Class2Type
Represents the transformation rule to transform classes
Inheritance
Inherited Members
Namespace: NMF.Models.Meta
Assembly: NMF.Models.MetaTransformation.dll
Syntax
public class Meta2ClassesTransformation.Class2Type : ClassGenerator<IClass>
Methods
| Edit this page View SourceAddAttributesOfClass<T>(IClass, CodeTypeDeclaration, Func<T, IAttribute, CodeMemberProperty, ITransformationContext, T>, T, ITransformationContext)
Iterates the attributes of the given class
Declaration
protected T AddAttributesOfClass<T>(IClass input, CodeTypeDeclaration typeDeclaration, Func<T, IAttribute, CodeMemberProperty, ITransformationContext, T> action, T initial, ITransformationContext context)
Parameters
Type | Name | Description |
---|---|---|
IClass | input | The class whose attributes should be iterated |
CodeTypeDeclaration | typeDeclaration | The generated type declaration for the input |
Func<T, IAttribute, CodeMemberProperty, ITransformationContext, T> | action | The action that should be performed for each attribute |
T | initial | The initial result |
ITransformationContext | context | The context in which the attributes should be iterated |
Returns
Type | Description |
---|---|
T | The result after all attributes have been processed |
Type Parameters
Name | Description |
---|---|
T | The result type |
AddImplementationBaseClass(CodeTypeDeclaration)
Adds the implementation base class for the framework, i.e. ModelElement
Declaration
protected override void AddImplementationBaseClass(CodeTypeDeclaration generatedType)
Parameters
Type | Name | Description |
---|---|---|
CodeTypeDeclaration | generatedType | The generated type |
Overrides
| Edit this page View SourceAddOperationsOfClass<T>(IClass, CodeTypeDeclaration, Func<T, IOperation, ITransformationContext, T>, T, ITransformationContext)
Iterates all operations of the given class
Declaration
protected T AddOperationsOfClass<T>(IClass input, CodeTypeDeclaration typeDeclaration, Func<T, IOperation, ITransformationContext, T> action, T initial, ITransformationContext context)
Parameters
Type | Name | Description |
---|---|---|
IClass | input | The input class |
CodeTypeDeclaration | typeDeclaration | The class declaration in the context of which the operations are iterated |
Func<T, IOperation, ITransformationContext, T> | action | an action that should be performed for each operation |
T | initial | the initial result |
ITransformationContext | context | the context in which the operations are iterated |
Returns
Type | Description |
---|---|
T | the result after all operations have been iterated |
Type Parameters
Name | Description |
---|---|
T | The type of the result |
AddReferencesOfClass<T>(IClass, CodeTypeDeclaration, Func<T, IReference, CodeMemberProperty, ITransformationContext, T>, T, bool, ITransformationContext)
Iterates all references of the given class
Declaration
protected T AddReferencesOfClass<T>(IClass input, CodeTypeDeclaration typeDeclaration, Func<T, IReference, CodeMemberProperty, ITransformationContext, T> action, T initial, bool containmentsOnly, ITransformationContext context)
Parameters
Type | Name | Description |
---|---|---|
IClass | input | The start class |
CodeTypeDeclaration | typeDeclaration | The type declaration in the context of which the references should be added |
Func<T, IReference, CodeMemberProperty, ITransformationContext, T> | action | the action that should be performed for each reference |
T | initial | an initial result object |
bool | containmentsOnly | if true, only containment references are considered |
ITransformationContext | context | The context in which the references should be visited |
Returns
Type | Description |
---|---|
T | the result object after is has been applied for all references |
Type Parameters
Name | Description |
---|---|
T | The type of the result |
CreateAbstractGetClassMethod(IClass, ITransformationContext)
Creates an abstract type-safe Get(Class) method
Declaration
protected virtual CodeMemberMethod CreateAbstractGetClassMethod(IClass input, ITransformationContext context)
Parameters
Type | Name | Description |
---|---|---|
IClass | input | The type of class that the method shall return |
ITransformationContext | context | The context in which this call is made |
Returns
Type | Description |
---|---|
CodeMemberMethod | A code method declaration |
CreateCallOperation(IClass, CodeTypeDeclaration, ITransformationContext)
Creates the CallOperation method
Declaration
protected virtual CodeMemberMethod CreateCallOperation(IClass input, CodeTypeDeclaration generatedType, ITransformationContext context)
Parameters
Type | Name | Description |
---|---|---|
IClass | input | The NMeta class for which to generate the method |
CodeTypeDeclaration | generatedType | The generated type for the class |
ITransformationContext | context | The transformaion context |
Returns
Type | Description |
---|---|
CodeMemberMethod | The CallOperation method |
CreateChildren(IClass, CodeTypeDeclaration, ITransformationContext)
Generates the Children property for the given class
Declaration
protected virtual CodeMemberProperty CreateChildren(IClass input, CodeTypeDeclaration generatedType, ITransformationContext context)
Parameters
Type | Name | Description |
---|---|---|
IClass | input | The NMeta class for which to generate the Children property |
CodeTypeDeclaration | generatedType | The generated type for the class |
ITransformationContext | context | The transformation context |
Returns
Type | Description |
---|---|
CodeMemberProperty | The Children property for the given NMeta class |
CreateClassInstanceProperty(IClass, IClass, ITransformationContext, CodeMemberField, bool)
Generates a class instance property
Declaration
protected virtual CodeMemberProperty CreateClassInstanceProperty(IClass input, IClass instantiating, ITransformationContext context, CodeMemberField classField, bool isOld)
Parameters
Type | Name | Description |
---|---|---|
IClass | input | The class for which the property shall be generated |
IClass | instantiating | The type of class that should be returned |
ITransformationContext | context | The context in which the request is made |
CodeMemberField | classField | The class field |
bool | isOld | True, if there is already an inherited property with the same name, otherwise False |
Returns
Type | Description |
---|---|
CodeMemberProperty | A property declaration or null |
CreateGetAttributeValue(IClass, CodeTypeDeclaration, ITransformationContext)
Generates the GetAttributeValue method
Declaration
protected virtual CodeMemberMethod CreateGetAttributeValue(IClass input, CodeTypeDeclaration generatedType, ITransformationContext context)
Parameters
Type | Name | Description |
---|---|---|
IClass | input | The NMeta class for which to generate the method |
CodeTypeDeclaration | generatedType | The generated type for the class |
ITransformationContext | context | The transformaion context |
Returns
Type | Description |
---|---|
CodeMemberMethod | The GetAttributeValue method for the given class |
CreateGetCollectionForFeature(IClass, CodeTypeDeclaration, ITransformationContext)
Generates the GetCollectionForFeature method
Declaration
protected virtual CodeMemberMethod CreateGetCollectionForFeature(IClass input, CodeTypeDeclaration generatedType, ITransformationContext context)
Parameters
Type | Name | Description |
---|---|---|
IClass | input | The NMeta class for which to generate the method |
CodeTypeDeclaration | generatedType | The generated type for the class |
ITransformationContext | context | The transformaion context |
Returns
Type | Description |
---|---|
CodeMemberMethod | The GetCollectionForFeature method |
CreateGetCompositionName(IClass, CodeTypeDeclaration, ITransformationContext)
Generates the GetCompositionName method
Declaration
protected virtual CodeMemberMethod CreateGetCompositionName(IClass input, CodeTypeDeclaration generatedType, ITransformationContext context)
Parameters
Type | Name | Description |
---|---|---|
IClass | input | The class for which the method is generated |
CodeTypeDeclaration | generatedType | The generated type declaration |
ITransformationContext | context | The context in which the request is made |
Returns
Type | Description |
---|---|
CodeMemberMethod | A method declaration |
CreateGetExpressionForAttribute(IClass, CodeTypeDeclaration, ITransformationContext)
Creates the GetExpressionForAttribute method
Declaration
protected virtual CodeMemberMethod CreateGetExpressionForAttribute(IClass input, CodeTypeDeclaration generatedType, ITransformationContext context)
Parameters
Type | Name | Description |
---|---|---|
IClass | input | The NMeta class for which to generate the method |
CodeTypeDeclaration | generatedType | The generated type for the class |
ITransformationContext | context | The transformaion context |
Returns
Type | Description |
---|---|
CodeMemberMethod | The GetExpressionForAttribute method |
CreateGetExpressionForReference(IClass, CodeTypeDeclaration, ITransformationContext)
Creates the GetExpressionForReference method
Declaration
protected virtual CodeMemberMethod CreateGetExpressionForReference(IClass input, CodeTypeDeclaration generatedType, ITransformationContext context)
Parameters
Type | Name | Description |
---|---|---|
IClass | input | The NMeta class for which to generate the method |
CodeTypeDeclaration | generatedType | The generated type for the class |
ITransformationContext | context | The transformaion context |
Returns
Type | Description |
---|---|
CodeMemberMethod | The GetExpressionForReference method |
CreateGetModelElementForReference(IClass, CodeTypeDeclaration, ITransformationContext)
Generates the method to resolve referenced model elements by reference name and index
Declaration
protected virtual CodeMemberMethod CreateGetModelElementForReference(IClass input, CodeTypeDeclaration generatedType, ITransformationContext context)
Parameters
Type | Name | Description |
---|---|---|
IClass | input | The NMeta class for which to generate the method |
CodeTypeDeclaration | generatedType | The generated type for the class |
ITransformationContext | context | The transformaion context |
Returns
Type | Description |
---|---|
CodeMemberMethod | The GetModelElementsForReference method |
CreateGetRelativePathForNonIdentifiedChild(IClass, CodeTypeDeclaration, ITransformationContext)
Generates the method to create a relative path for a given child model element
Declaration
protected virtual CodeMemberMethod CreateGetRelativePathForNonIdentifiedChild(IClass input, CodeTypeDeclaration generatedType, ITransformationContext context)
Parameters
Type | Name | Description |
---|---|---|
IClass | input | The NMeta class for which to generate the method |
CodeTypeDeclaration | generatedType | The generated type for the class |
ITransformationContext | context | The transformation context |
Returns
Type | Description |
---|---|
CodeMemberMethod | The GetRelativePathForNonIdentifiedChild method |
CreateOutput(IClass, ITransformationContext)
Creates the output the transformation rule
Declaration
public override CodeTypeDeclaration CreateOutput(IClass input, ITransformationContext context)
Parameters
Type | Name | Description |
---|---|---|
IClass | input | The input model element |
ITransformationContext | context | The transformaton context |
Returns
Type | Description |
---|---|
CodeTypeDeclaration | A new code type declaration with set reference that references back to the code declaration |
Overrides
| Edit this page View SourceCreateOverriddenGetClassMethod(IClass, IClass, ITransformationContext, CodeMemberField, bool)
Creates the overridden type-safe Get(Class) method
Declaration
protected virtual CodeMemberMethod CreateOverriddenGetClassMethod(IClass input, IClass instantiating, ITransformationContext context, CodeMemberField classField, bool isOverride)
Parameters
Type | Name | Description |
---|---|---|
IClass | input | The class for which the method is generated |
IClass | instantiating | The return type of the method |
ITransformationContext | context | The context in which the request is made |
CodeMemberField | classField | The class field |
bool | isOverride | True, if this is an override, otherwise false |
Returns
Type | Description |
---|---|
CodeMemberMethod | A method declaration |
CreateReferencesProperty(IClass, CodeTypeDeclaration, ITransformationContext)
Creates the property for the referenced elements
Declaration
protected virtual CodeMemberProperty CreateReferencesProperty(IClass input, CodeTypeDeclaration generatedType, ITransformationContext context)
Parameters
Type | Name | Description |
---|---|---|
IClass | input | The input NMeta class |
CodeTypeDeclaration | generatedType | The generated type for the class |
ITransformationContext | context | The transformation context |
Returns
Type | Description |
---|---|
CodeMemberProperty | The code property that implements the references property |
CreateSeparatePublicInterface(IClass, CodeTypeDeclaration)
Creates the public interface for the given NMeta class
Declaration
protected override CodeTypeDeclaration CreateSeparatePublicInterface(IClass input, CodeTypeDeclaration generatedType)
Parameters
Type | Name | Description |
---|---|---|
IClass | input | The NMeta class |
CodeTypeDeclaration | generatedType | The generated type |
Returns
Type | Description |
---|---|
CodeTypeDeclaration | A new type declaration that has attributes set same like the original type |
Overrides
| Edit this page View SourceCreateSetFeature(IClass, CodeTypeDeclaration, ITransformationContext)
Creates the SetFeature method
Declaration
protected virtual CodeMemberMethod CreateSetFeature(IClass input, CodeTypeDeclaration generatedType, ITransformationContext context)
Parameters
Type | Name | Description |
---|---|---|
IClass | input | The NMeta class for which to generate the method |
CodeTypeDeclaration | generatedType | The generated type for the class |
ITransformationContext | context | The transformaion context |
Returns
Type | Description |
---|---|
CodeMemberMethod | The SetFeature method |
GetInterfaceType(IClass, ITransformationContext)
Gets the interface type for the given instantiating class
Declaration
protected virtual CodeTypeReference GetInterfaceType(IClass instantiating, ITransformationContext context)
Parameters
Type | Name | Description |
---|---|---|
IClass | instantiating | The instantiating class |
ITransformationContext | context | The context in which the request is made |
Returns
Type | Description |
---|---|
CodeTypeReference |
GetName(IClass)
Gets the name of the generated class for the given NMeta class
Declaration
protected override string GetName(IClass input)
Parameters
Type | Name | Description |
---|---|---|
IClass | input | The NMeta class |
Returns
Type | Description |
---|---|
string | The name of the generated class |
Overrides
| Edit this page View SourceImplementIdentifier(IClass, CodeTypeDeclaration, ITransformationContext)
Implements the members necessary for the identifier mechanism of the given NMeta class
Declaration
protected virtual void ImplementIdentifier(IClass @class, CodeTypeDeclaration generatedType, ITransformationContext context)
Parameters
Type | Name | Description |
---|---|---|
IClass | class | The NMeta class |
CodeTypeDeclaration | generatedType | The generated type for the NMeta class |
ITransformationContext | context | The context in which the class is generated |
RegisterDependencies()
Registers the dependencies: Marks the rule instantiating for Type2Type and requires to generate members and base classes
Declaration
public override void RegisterDependencies()
Overrides
| Edit this page View SourceShouldContainMembers(CodeTypeDeclaration, CodeTypeDeclaration)
Determines whether the provided type should contain members of the given base type
Declaration
protected override bool ShouldContainMembers(CodeTypeDeclaration generatedType, CodeTypeDeclaration baseType)
Parameters
Type | Name | Description |
---|---|---|
CodeTypeDeclaration | generatedType | The type that is currently being generated |
CodeTypeDeclaration | baseType | The base types |
Returns
Type | Description |
---|---|
bool | True if so, otherwise false |
Overrides
| Edit this page View SourceTransform(IClass, CodeTypeDeclaration, ITransformationContext)
Initializes the generated class
Declaration
public override void Transform(IClass input, CodeTypeDeclaration generatedType, ITransformationContext context)
Parameters
Type | Name | Description |
---|---|---|
IClass | input | The input NMeta class |
CodeTypeDeclaration | generatedType | The generated type |
ITransformationContext | context | The transformation context |