Class Meta2ClassesTransformation.DataType2Type
The transformation rule to generate a struct from an NMeta DataType
Inheritance
Inherited Members
Namespace: NMF.Models.Meta
Assembly: NMF.Models.MetaTransformation.dll
Syntax
public class Meta2ClassesTransformation.DataType2Type : TransformationRule<IDataType, CodeTypeDeclaration>
Methods
| Edit this page View SourceCreateEqualsOperator(IDataType, CodeTypeDeclaration, ITransformationContext)
Creates an equals operator
Declaration
public virtual CodeTypeMember CreateEqualsOperator(IDataType dataType, CodeTypeDeclaration generatedType, ITransformationContext context)
Parameters
Type | Name | Description |
---|---|---|
IDataType | dataType | The data type for which the operator should be generated |
CodeTypeDeclaration | generatedType | the generated type definition |
ITransformationContext | context | The context in which the request is made |
Returns
Type | Description |
---|---|
CodeTypeMember | An equals operator |
CreateGenericEquals(IDataType, CodeTypeDeclaration, ITransformationContext)
Generates the generic Equals method implementing Equals
Declaration
protected virtual CodeMemberMethod CreateGenericEquals(IDataType input, CodeTypeDeclaration generatedType, ITransformationContext context)
Parameters
Type | Name | Description |
---|---|---|
IDataType | input | The NMeta data type |
CodeTypeDeclaration | generatedType | The type generated for the given data type |
ITransformationContext | context | The transformation context |
Returns
Type | Description |
---|---|
CodeMemberMethod |
CreateGetHashCode(IDataType, ITransformationContext)
Generates a GetHashCode method
Declaration
protected virtual CodeMemberMethod CreateGetHashCode(IDataType input, ITransformationContext context)
Parameters
Type | Name | Description |
---|---|---|
IDataType | input | The data type for which the GetHashCode method should be generated |
ITransformationContext | context | The context in which the transformation is made |
Returns
Type | Description |
---|---|
CodeMemberMethod | A definition of the GetHashCode method |
CreateNotEqualsOperator(IDataType, CodeTypeDeclaration, ITransformationContext)
Creates a not-equals operator
Declaration
public virtual CodeTypeMember CreateNotEqualsOperator(IDataType dataType, CodeTypeDeclaration generatedType, ITransformationContext context)
Parameters
Type | Name | Description |
---|---|---|
IDataType | dataType | The data type for which the operator should be generated |
CodeTypeDeclaration | generatedType | The generated tye definition |
ITransformationContext | context | The context in which the request is made |
Returns
Type | Description |
---|---|
CodeTypeMember | An unequals operator |
CreateObjectEquals(IDataType, CodeTypeDeclaration, ITransformationContext)
Generates the Object Equals overriding method
Declaration
protected virtual CodeMemberMethod CreateObjectEquals(IDataType input, CodeTypeDeclaration output, ITransformationContext context)
Parameters
Type | Name | Description |
---|---|---|
IDataType | input | The NMeta DataType for which to generate the Equals method |
CodeTypeDeclaration | output | The generated type declaration |
ITransformationContext | context | The transformation context |
Returns
Type | Description |
---|---|
CodeMemberMethod |
CreateOutput(IDataType, ITransformationContext)
Creates the output of this transformation rule
Declaration
public override CodeTypeDeclaration CreateOutput(IDataType input, ITransformationContext context)
Parameters
Type | Name | Description |
---|---|---|
IDataType | input | The input NMeta DataType |
ITransformationContext | context | The transformation context |
Returns
Type | Description |
---|---|
CodeTypeDeclaration | The generated code declaration |
Overrides
CreateSerializeToJson(IDataType, ITransformationContext)
Creates a method that exports the data type to Json
Declaration
public virtual CodeMemberMethod CreateSerializeToJson(IDataType dataType, ITransformationContext context)
Parameters
Type | Name | Description |
---|---|---|
IDataType | dataType | The data type |
ITransformationContext | context | The context in which the request is made |
Returns
Type | Description |
---|---|
CodeMemberMethod | A method declaration |
CreateTryParseJsonMethod(IDataType, CodeTypeDeclaration, ITransformationContext)
Creates a TryParse method targeted for Json
Declaration
public virtual CodeMemberMethod CreateTryParseJsonMethod(IDataType dataType, CodeTypeDeclaration generatedType, ITransformationContext context)
Parameters
Type | Name | Description |
---|---|---|
IDataType | dataType | The data type |
CodeTypeDeclaration | generatedType | The generated type definition |
ITransformationContext | context | The context in which the call is made |
Returns
Type | Description |
---|---|
CodeMemberMethod | A method declaration |
CreateTypeConverter(IDataType, CodeTypeDeclaration, ITransformationContext)
Creates a type converter for the given data type
Declaration
protected virtual CodeTypeDeclaration CreateTypeConverter(IDataType dataType, CodeTypeDeclaration generatedType, ITransformationContext context)
Parameters
Type | Name | Description |
---|---|---|
IDataType | dataType | The data type |
CodeTypeDeclaration | generatedType | The generated type |
ITransformationContext | context | The context in which the request is made |
Returns
Type | Description |
---|---|
CodeTypeDeclaration | A type declaration of the type converter |
RegisterDependencies()
Registers the dependencies, i.e. marks the rule instantiating for Type2Type and requires the transformation of attributes
Declaration
public override void RegisterDependencies()
Overrides
| Edit this page View SourceTransform(IDataType, CodeTypeDeclaration, ITransformationContext)
Initializes the generated code declaration
Declaration
public override void Transform(IDataType input, CodeTypeDeclaration generatedType, ITransformationContext context)
Parameters
Type | Name | Description |
---|---|---|
IDataType | input | The NMeta DataType for which to generate the struct type declaration |
CodeTypeDeclaration | generatedType | The type declaration for the struct |
ITransformationContext | context | The transformation context |