Table of Contents

Class Meta2ClassesTransformation.Class2Type

Namespace
NMF.Models.Meta
Assembly
NMF.Models.MetaTransformation.dll

Represents the transformation rule to transform classes

public class Meta2ClassesTransformation.Class2Type : ClassGenerator<IClass>
Inheritance
Meta2ClassesTransformation.Class2Type
Inherited Members

Methods

AddAttributesOfClass<T>(IClass, CodeTypeDeclaration, Func<T, IAttribute, CodeMemberProperty, ITransformationContext, T>, T, ITransformationContext)

Iterates the attributes of the given class

protected T AddAttributesOfClass<T>(IClass input, CodeTypeDeclaration typeDeclaration, Func<T, IAttribute, CodeMemberProperty, ITransformationContext, T> action, T initial, ITransformationContext context)

Parameters

input IClass

The class whose attributes should be iterated

typeDeclaration CodeTypeDeclaration

The generated type declaration for the input

action Func<T, IAttribute, CodeMemberProperty, ITransformationContext, T>

The action that should be performed for each attribute

initial T

The initial result

context ITransformationContext

The context in which the attributes should be iterated

Returns

T

The result after all attributes have been processed

Type Parameters

T

The result type

AddImplementationBaseClass(CodeTypeDeclaration)

Adds the implementation base class for the framework, i.e. ModelElement

protected override void AddImplementationBaseClass(CodeTypeDeclaration generatedType)

Parameters

generatedType CodeTypeDeclaration

The generated type

AddOperationsOfClass<T>(IClass, CodeTypeDeclaration, Func<T, IOperation, ITransformationContext, T>, T, ITransformationContext)

Iterates all operations of the given class

protected T AddOperationsOfClass<T>(IClass input, CodeTypeDeclaration typeDeclaration, Func<T, IOperation, ITransformationContext, T> action, T initial, ITransformationContext context)

Parameters

input IClass

The input class

typeDeclaration CodeTypeDeclaration

The class declaration in the context of which the operations are iterated

action Func<T, IOperation, ITransformationContext, T>

an action that should be performed for each operation

initial T

the initial result

context ITransformationContext

the context in which the operations are iterated

Returns

T

the result after all operations have been iterated

Type Parameters

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

protected T AddReferencesOfClass<T>(IClass input, CodeTypeDeclaration typeDeclaration, Func<T, IReference, CodeMemberProperty, ITransformationContext, T> action, T initial, bool containmentsOnly, ITransformationContext context)

Parameters

input IClass

The start class

typeDeclaration CodeTypeDeclaration

The type declaration in the context of which the references should be added

action Func<T, IReference, CodeMemberProperty, ITransformationContext, T>

the action that should be performed for each reference

initial T

an initial result object

containmentsOnly bool

if true, only containment references are considered

context ITransformationContext

The context in which the references should be visited

Returns

T

the result object after is has been applied for all references

Type Parameters

T

The type of the result

AddRefinedAttributesOfClass<T>(IClass, CodeTypeDeclaration, Func<T, IAttribute, CodeMemberProperty, ITransformationContext, T>, T, ITransformationContext)

Iterates the attributes of the given class

protected T AddRefinedAttributesOfClass<T>(IClass input, CodeTypeDeclaration typeDeclaration, Func<T, IAttribute, CodeMemberProperty, ITransformationContext, T> action, T initial, ITransformationContext context)

Parameters

input IClass

The class whose attributes should be iterated

typeDeclaration CodeTypeDeclaration

The generated type declaration for the input

action Func<T, IAttribute, CodeMemberProperty, ITransformationContext, T>

The action that should be performed for each attribute

initial T

The initial result

context ITransformationContext

The context in which the attributes should be iterated

Returns

T

The result after all attributes have been processed

Type Parameters

T

The result type

AddRefinedReferencesOfClass<T>(IClass, CodeTypeDeclaration, Func<T, IReference, CodeMemberProperty, ITransformationContext, T>, T, bool, ITransformationContext)

Iterates all references of the given class

protected T AddRefinedReferencesOfClass<T>(IClass input, CodeTypeDeclaration typeDeclaration, Func<T, IReference, CodeMemberProperty, ITransformationContext, T> action, T initial, bool containmentsOnly, ITransformationContext context)

Parameters

input IClass

The start class

typeDeclaration CodeTypeDeclaration

The type declaration in the context of which the references should be added

action Func<T, IReference, CodeMemberProperty, ITransformationContext, T>

the action that should be performed for each reference

initial T

an initial result object

containmentsOnly bool

if true, only containment references are considered

context ITransformationContext

The context in which the references should be visited

Returns

T

the result object after is has been applied for all references

Type Parameters

T

The type of the result

CreateAbstractGetClassMethod(IClass, ITransformationContext)

Creates an abstract type-safe Get(Class) method

protected virtual CodeMemberMethod CreateAbstractGetClassMethod(IClass input, ITransformationContext context)

Parameters

input IClass

The type of class that the method shall return

context ITransformationContext

The context in which this call is made

Returns

CodeMemberMethod

A code method declaration

CreateCallOperation(IClass, CodeTypeDeclaration, ITransformationContext)

Creates the CallOperation method

protected virtual CodeMemberMethod CreateCallOperation(IClass input, CodeTypeDeclaration generatedType, ITransformationContext context)

Parameters

input IClass

The NMeta class for which to generate the method

generatedType CodeTypeDeclaration

The generated type for the class

context ITransformationContext

The transformaion context

Returns

CodeMemberMethod

The CallOperation method

CreateChildren(IClass, CodeTypeDeclaration, ITransformationContext)

Generates the Children property for the given class

protected virtual CodeMemberProperty CreateChildren(IClass input, CodeTypeDeclaration generatedType, ITransformationContext context)

Parameters

input IClass

The NMeta class for which to generate the Children property

generatedType CodeTypeDeclaration

The generated type for the class

context ITransformationContext

The transformation context

Returns

CodeMemberProperty

The Children property for the given NMeta class

CreateClassInstanceProperty(IClass, IClass, ITransformationContext, CodeMemberField, bool)

Generates a class instance property

protected virtual CodeMemberProperty CreateClassInstanceProperty(IClass input, IClass instantiating, ITransformationContext context, CodeMemberField classField, bool isOld)

Parameters

input IClass

The class for which the property shall be generated

instantiating IClass

The type of class that should be returned

context ITransformationContext

The context in which the request is made

classField CodeMemberField

The class field

isOld bool

True, if there is already an inherited property with the same name, otherwise False

Returns

CodeMemberProperty

A property declaration or null

CreateGetAttributeValue(IClass, CodeTypeDeclaration, ITransformationContext)

Generates the GetAttributeValue method

protected virtual CodeMemberMethod CreateGetAttributeValue(IClass input, CodeTypeDeclaration generatedType, ITransformationContext context)

Parameters

input IClass

The NMeta class for which to generate the method

generatedType CodeTypeDeclaration

The generated type for the class

context ITransformationContext

The transformaion context

Returns

CodeMemberMethod

The GetAttributeValue method for the given class

CreateGetCollectionForFeature(IClass, CodeTypeDeclaration, ITransformationContext)

Generates the GetCollectionForFeature method

protected virtual CodeMemberMethod CreateGetCollectionForFeature(IClass input, CodeTypeDeclaration generatedType, ITransformationContext context)

Parameters

input IClass

The NMeta class for which to generate the method

generatedType CodeTypeDeclaration

The generated type for the class

context ITransformationContext

The transformaion context

Returns

CodeMemberMethod

The GetCollectionForFeature method

CreateGetCompositionName(IClass, CodeTypeDeclaration, ITransformationContext)

Generates the GetCompositionName method

protected virtual CodeMemberMethod CreateGetCompositionName(IClass input, CodeTypeDeclaration generatedType, ITransformationContext context)

Parameters

input IClass

The class for which the method is generated

generatedType CodeTypeDeclaration

The generated type declaration

context ITransformationContext

The context in which the request is made

Returns

CodeMemberMethod

A method declaration

CreateGetExpressionForAttribute(IClass, CodeTypeDeclaration, ITransformationContext)

Creates the GetExpressionForAttribute method

protected virtual CodeMemberMethod CreateGetExpressionForAttribute(IClass input, CodeTypeDeclaration generatedType, ITransformationContext context)

Parameters

input IClass

The NMeta class for which to generate the method

generatedType CodeTypeDeclaration

The generated type for the class

context ITransformationContext

The transformaion context

Returns

CodeMemberMethod

The GetExpressionForAttribute method

CreateGetExpressionForReference(IClass, CodeTypeDeclaration, ITransformationContext)

Creates the GetExpressionForReference method

protected virtual CodeMemberMethod CreateGetExpressionForReference(IClass input, CodeTypeDeclaration generatedType, ITransformationContext context)

Parameters

input IClass

The NMeta class for which to generate the method

generatedType CodeTypeDeclaration

The generated type for the class

context ITransformationContext

The transformaion context

Returns

CodeMemberMethod

The GetExpressionForReference method

CreateGetModelElementForReference(IClass, CodeTypeDeclaration, ITransformationContext)

Generates the method to resolve referenced model elements by reference name and index

protected virtual CodeMemberMethod CreateGetModelElementForReference(IClass input, CodeTypeDeclaration generatedType, ITransformationContext context)

Parameters

input IClass

The NMeta class for which to generate the method

generatedType CodeTypeDeclaration

The generated type for the class

context ITransformationContext

The transformaion context

Returns

CodeMemberMethod

The GetModelElementsForReference method

CreateGetRelativePathForNonIdentifiedChild(IClass, CodeTypeDeclaration, ITransformationContext)

Generates the method to create a relative path for a given child model element

protected virtual CodeMemberMethod CreateGetRelativePathForNonIdentifiedChild(IClass input, CodeTypeDeclaration generatedType, ITransformationContext context)

Parameters

input IClass

The NMeta class for which to generate the method

generatedType CodeTypeDeclaration

The generated type for the class

context ITransformationContext

The transformation context

Returns

CodeMemberMethod

The GetRelativePathForNonIdentifiedChild method

CreateInterfaceMembers(IClass, CodeTypeDeclaration, CodeTypeDeclaration, ITransformationContext)

Generates the interface members for the given type

protected override void CreateInterfaceMembers(IClass input, CodeTypeDeclaration generatedType, CodeTypeDeclaration interfaceDecl, ITransformationContext context)

Parameters

input IClass

The input for which the interface members need to be generated

generatedType CodeTypeDeclaration

The generated type

interfaceDecl CodeTypeDeclaration

The interface declaration

context ITransformationContext

The transformation context

CreateOutput(IClass, ITransformationContext)

Creates the output the transformation rule

public override CodeTypeDeclaration CreateOutput(IClass input, ITransformationContext context)

Parameters

input IClass

The input model element

context ITransformationContext

The transformaton context

Returns

CodeTypeDeclaration

A new code type declaration with set reference that references back to the code declaration

CreateOverriddenGetClassMethod(IClass, IClass, ITransformationContext, CodeMemberField, bool)

Creates the overridden type-safe Get(Class) method

protected virtual CodeMemberMethod CreateOverriddenGetClassMethod(IClass input, IClass instantiating, ITransformationContext context, CodeMemberField classField, bool isOverride)

Parameters

input IClass

The class for which the method is generated

instantiating IClass

The return type of the method

context ITransformationContext

The context in which the request is made

classField CodeMemberField

The class field

isOverride bool

True, if this is an override, otherwise false

Returns

CodeMemberMethod

A method declaration

CreateReferencesProperty(IClass, CodeTypeDeclaration, ITransformationContext)

Creates the property for the referenced elements

protected virtual CodeMemberProperty CreateReferencesProperty(IClass input, CodeTypeDeclaration generatedType, ITransformationContext context)

Parameters

input IClass

The input NMeta class

generatedType CodeTypeDeclaration

The generated type for the class

context ITransformationContext

The transformation context

Returns

CodeMemberProperty

The code property that implements the references property

CreateSeparatePublicInterface(IClass, CodeTypeDeclaration)

Creates the public interface for the given NMeta class

protected override CodeTypeDeclaration CreateSeparatePublicInterface(IClass input, CodeTypeDeclaration generatedType)

Parameters

input IClass

The NMeta class

generatedType CodeTypeDeclaration

The generated type

Returns

CodeTypeDeclaration

A new type declaration that has attributes set same like the original type

CreateSetFeature(IClass, CodeTypeDeclaration, ITransformationContext)

Creates the SetFeature method

protected virtual CodeMemberMethod CreateSetFeature(IClass input, CodeTypeDeclaration generatedType, ITransformationContext context)

Parameters

input IClass

The NMeta class for which to generate the method

generatedType CodeTypeDeclaration

The generated type for the class

context ITransformationContext

The transformaion context

Returns

CodeMemberMethod

The SetFeature method

GetInterfaceType(IClass, ITransformationContext)

Gets the interface type for the given instantiating class

protected virtual CodeTypeReference GetInterfaceType(IClass instantiating, ITransformationContext context)

Parameters

instantiating IClass

The instantiating class

context ITransformationContext

The context in which the request is made

Returns

CodeTypeReference

GetName(IClass)

Gets the name of the generated class for the given NMeta class

protected override string GetName(IClass input)

Parameters

input IClass

The NMeta class

Returns

string

The name of the generated class

ImplementIdentifier(IClass, CodeTypeDeclaration, ITransformationContext)

Implements the members necessary for the identifier mechanism of the given NMeta class

protected virtual void ImplementIdentifier(IClass @class, CodeTypeDeclaration generatedType, ITransformationContext context)

Parameters

class IClass

The NMeta class

generatedType CodeTypeDeclaration

The generated type for the NMeta class

context ITransformationContext

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

public override void RegisterDependencies()

ShouldContainMembers(CodeTypeDeclaration, CodeTypeDeclaration)

Determines whether the provided type should contain members of the given base type

protected override bool ShouldContainMembers(CodeTypeDeclaration generatedType, CodeTypeDeclaration baseType)

Parameters

generatedType CodeTypeDeclaration

The type that is currently being generated

baseType CodeTypeDeclaration

The base types

Returns

bool

True if so, otherwise false

Transform(IClass, CodeTypeDeclaration, ITransformationContext)

Initializes the generated class

public override void Transform(IClass input, CodeTypeDeclaration generatedType, ITransformationContext context)

Parameters

input IClass

The input NMeta class

generatedType CodeTypeDeclaration

The generated type

context ITransformationContext

The transformation context