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
inputIClassThe class whose attributes should be iterated
typeDeclarationCodeTypeDeclarationThe generated type declaration for the input
actionFunc<T, IAttribute, CodeMemberProperty, ITransformationContext, T>The action that should be performed for each attribute
initialTThe initial result
contextITransformationContextThe context in which the attributes should be iterated
Returns
- T
The result after all attributes have been processed
Type Parameters
TThe result type
AddImplementationBaseClass(CodeTypeDeclaration)
Adds the implementation base class for the framework, i.e. ModelElement
protected override void AddImplementationBaseClass(CodeTypeDeclaration generatedType)
Parameters
generatedTypeCodeTypeDeclarationThe 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
inputIClassThe input class
typeDeclarationCodeTypeDeclarationThe class declaration in the context of which the operations are iterated
actionFunc<T, IOperation, ITransformationContext, T>an action that should be performed for each operation
initialTthe initial result
contextITransformationContextthe context in which the operations are iterated
Returns
- T
the result after all operations have been iterated
Type Parameters
TThe 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
inputIClassThe start class
typeDeclarationCodeTypeDeclarationThe type declaration in the context of which the references should be added
actionFunc<T, IReference, CodeMemberProperty, ITransformationContext, T>the action that should be performed for each reference
initialTan initial result object
containmentsOnlyboolif true, only containment references are considered
contextITransformationContextThe context in which the references should be visited
Returns
- T
the result object after is has been applied for all references
Type Parameters
TThe 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
inputIClassThe class whose attributes should be iterated
typeDeclarationCodeTypeDeclarationThe generated type declaration for the input
actionFunc<T, IAttribute, CodeMemberProperty, ITransformationContext, T>The action that should be performed for each attribute
initialTThe initial result
contextITransformationContextThe context in which the attributes should be iterated
Returns
- T
The result after all attributes have been processed
Type Parameters
TThe 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
inputIClassThe start class
typeDeclarationCodeTypeDeclarationThe type declaration in the context of which the references should be added
actionFunc<T, IReference, CodeMemberProperty, ITransformationContext, T>the action that should be performed for each reference
initialTan initial result object
containmentsOnlyboolif true, only containment references are considered
contextITransformationContextThe context in which the references should be visited
Returns
- T
the result object after is has been applied for all references
Type Parameters
TThe type of the result
CreateAbstractGetClassMethod(IClass, ITransformationContext)
Creates an abstract type-safe Get(Class) method
protected virtual CodeMemberMethod CreateAbstractGetClassMethod(IClass input, ITransformationContext context)
Parameters
inputIClassThe type of class that the method shall return
contextITransformationContextThe 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
inputIClassThe NMeta class for which to generate the method
generatedTypeCodeTypeDeclarationThe generated type for the class
contextITransformationContextThe 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
inputIClassThe NMeta class for which to generate the Children property
generatedTypeCodeTypeDeclarationThe generated type for the class
contextITransformationContextThe 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
inputIClassThe class for which the property shall be generated
instantiatingIClassThe type of class that should be returned
contextITransformationContextThe context in which the request is made
classFieldCodeMemberFieldThe class field
isOldboolTrue, 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
inputIClassThe NMeta class for which to generate the method
generatedTypeCodeTypeDeclarationThe generated type for the class
contextITransformationContextThe 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
inputIClassThe NMeta class for which to generate the method
generatedTypeCodeTypeDeclarationThe generated type for the class
contextITransformationContextThe 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
inputIClassThe class for which the method is generated
generatedTypeCodeTypeDeclarationThe generated type declaration
contextITransformationContextThe 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
inputIClassThe NMeta class for which to generate the method
generatedTypeCodeTypeDeclarationThe generated type for the class
contextITransformationContextThe 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
inputIClassThe NMeta class for which to generate the method
generatedTypeCodeTypeDeclarationThe generated type for the class
contextITransformationContextThe 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
inputIClassThe NMeta class for which to generate the method
generatedTypeCodeTypeDeclarationThe generated type for the class
contextITransformationContextThe 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
inputIClassThe NMeta class for which to generate the method
generatedTypeCodeTypeDeclarationThe generated type for the class
contextITransformationContextThe 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
inputIClassThe input for which the interface members need to be generated
generatedTypeCodeTypeDeclarationThe generated type
interfaceDeclCodeTypeDeclarationThe interface declaration
contextITransformationContextThe transformation context
CreateOutput(IClass, ITransformationContext)
Creates the output the transformation rule
public override CodeTypeDeclaration CreateOutput(IClass input, ITransformationContext context)
Parameters
inputIClassThe input model element
contextITransformationContextThe 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
inputIClassThe class for which the method is generated
instantiatingIClassThe return type of the method
contextITransformationContextThe context in which the request is made
classFieldCodeMemberFieldThe class field
isOverrideboolTrue, 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
inputIClassThe input NMeta class
generatedTypeCodeTypeDeclarationThe generated type for the class
contextITransformationContextThe 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
inputIClassThe NMeta class
generatedTypeCodeTypeDeclarationThe 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
inputIClassThe NMeta class for which to generate the method
generatedTypeCodeTypeDeclarationThe generated type for the class
contextITransformationContextThe 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
instantiatingIClassThe instantiating class
contextITransformationContextThe 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
inputIClassThe 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
classIClassThe NMeta class
generatedTypeCodeTypeDeclarationThe generated type for the NMeta class
contextITransformationContextThe 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
generatedTypeCodeTypeDeclarationThe type that is currently being generated
baseTypeCodeTypeDeclarationThe 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
inputIClassThe input NMeta class
generatedTypeCodeTypeDeclarationThe generated type
contextITransformationContextThe transformation context