Class Meta2ClassesTransformation.Class2Type
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
IClassThe class whose attributes should be iterated
typeDeclaration
CodeTypeDeclarationThe generated type declaration for the input
action
Func<T, IAttribute, CodeMemberProperty, ITransformationContext, T>The action that should be performed for each attribute
initial
TThe initial result
context
ITransformationContextThe 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
CodeTypeDeclarationThe 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
IClassThe input class
typeDeclaration
CodeTypeDeclarationThe 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
Tthe initial result
context
ITransformationContextthe 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
IClassThe start class
typeDeclaration
CodeTypeDeclarationThe 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
Tan initial result object
containmentsOnly
boolif true, only containment references are considered
context
ITransformationContextThe 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
IClassThe class whose attributes should be iterated
typeDeclaration
CodeTypeDeclarationThe generated type declaration for the input
action
Func<T, IAttribute, CodeMemberProperty, ITransformationContext, T>The action that should be performed for each attribute
initial
TThe initial result
context
ITransformationContextThe 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
IClassThe start class
typeDeclaration
CodeTypeDeclarationThe 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
Tan initial result object
containmentsOnly
boolif true, only containment references are considered
context
ITransformationContextThe 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
IClassThe type of class that the method shall return
context
ITransformationContextThe 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
IClassThe NMeta class for which to generate the method
generatedType
CodeTypeDeclarationThe generated type for the class
context
ITransformationContextThe 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
IClassThe NMeta class for which to generate the Children property
generatedType
CodeTypeDeclarationThe generated type for the class
context
ITransformationContextThe 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
IClassThe class for which the property shall be generated
instantiating
IClassThe type of class that should be returned
context
ITransformationContextThe context in which the request is made
classField
CodeMemberFieldThe class field
isOld
boolTrue, 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
IClassThe NMeta class for which to generate the method
generatedType
CodeTypeDeclarationThe generated type for the class
context
ITransformationContextThe 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
IClassThe NMeta class for which to generate the method
generatedType
CodeTypeDeclarationThe generated type for the class
context
ITransformationContextThe 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
IClassThe class for which the method is generated
generatedType
CodeTypeDeclarationThe generated type declaration
context
ITransformationContextThe 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
IClassThe NMeta class for which to generate the method
generatedType
CodeTypeDeclarationThe generated type for the class
context
ITransformationContextThe 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
IClassThe NMeta class for which to generate the method
generatedType
CodeTypeDeclarationThe generated type for the class
context
ITransformationContextThe 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
IClassThe NMeta class for which to generate the method
generatedType
CodeTypeDeclarationThe generated type for the class
context
ITransformationContextThe 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
IClassThe NMeta class for which to generate the method
generatedType
CodeTypeDeclarationThe generated type for the class
context
ITransformationContextThe 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
IClassThe input for which the interface members need to be generated
generatedType
CodeTypeDeclarationThe generated type
interfaceDecl
CodeTypeDeclarationThe interface declaration
context
ITransformationContextThe transformation context
CreateOutput(IClass, ITransformationContext)
Creates the output the transformation rule
public override CodeTypeDeclaration CreateOutput(IClass input, ITransformationContext context)
Parameters
input
IClassThe input model element
context
ITransformationContextThe 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
IClassThe class for which the method is generated
instantiating
IClassThe return type of the method
context
ITransformationContextThe context in which the request is made
classField
CodeMemberFieldThe class field
isOverride
boolTrue, 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
IClassThe input NMeta class
generatedType
CodeTypeDeclarationThe generated type for the class
context
ITransformationContextThe 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
IClassThe NMeta class
generatedType
CodeTypeDeclarationThe 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
IClassThe NMeta class for which to generate the method
generatedType
CodeTypeDeclarationThe generated type for the class
context
ITransformationContextThe 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
IClassThe instantiating class
context
ITransformationContextThe context in which the request is made
Returns
GetName(IClass)
Gets the name of the generated class for the given NMeta class
protected override string GetName(IClass input)
Parameters
input
IClassThe 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
IClassThe NMeta class
generatedType
CodeTypeDeclarationThe generated type for the NMeta class
context
ITransformationContextThe 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
CodeTypeDeclarationThe type that is currently being generated
baseType
CodeTypeDeclarationThe 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
IClassThe input NMeta class
generatedType
CodeTypeDeclarationThe generated type
context
ITransformationContextThe transformation context