Class EnumGenerator<T>
Represents a transformation rule that generates enumerations
public abstract class EnumGenerator<T> : TransformationRule<T, CodeTypeDeclaration> where T : class
Type Parameters
T
The model element type from which to generate enumerations
- Inheritance
-
EnumGenerator<T>
- Derived
- Inherited Members
-
TransformationRule<T, CodeTypeDeclaration>.Transform(T, CodeTypeDeclaration, ITransformationContext)TransformationRuleBase<T, CodeTypeDeclaration>.MarkInstantiatingFor<TBaseIn, TBaseOut>(Predicate<T>)TransformationRuleBase<T, CodeTypeDeclaration>.TraceOutput<TKey>(Func<T, CodeTypeDeclaration, TKey>)
Methods
CreateOutput(T, ITransformationContext)
Creates the code type declaration for the given input model element
public override CodeTypeDeclaration CreateOutput(T input, ITransformationContext context)
Parameters
input
TThe input model element
context
ITransformationContextThe transformation context
Returns
- CodeTypeDeclaration
The code type declaration that will be the transformation result for the given enumeration
GetIsFlagged(T)
Gets a value indicating whether the enumeration is flagged
protected virtual bool GetIsFlagged(T input)
Parameters
input
TThe input model element from which to generate the model
Returns
- bool
True, if the enumeration is flagged, otherwise false
GetMembers(T, CodeTypeDeclaration, ITransformationContext)
Gets the enumeration literals that should be generated for the given input model element
protected abstract IEnumerable<EnumGenerator<T>.EnumMember> GetMembers(T input, CodeTypeDeclaration generatedType, ITransformationContext context)
Parameters
input
TThe input model element
generatedType
CodeTypeDeclarationThe generated type
context
ITransformationContextThe context in which the enumeration is generated
Returns
- IEnumerable<EnumGenerator<T>.EnumMember>
A collection of enumeration members
GetName(T)
Gets the name of the enumeration class
protected abstract string GetName(T input)
Parameters
input
TThe input model element from which to generate the enumeration class
Returns
- string
The name of the enumeration
Transform(T, CodeTypeDeclaration, ITransformationContext)
Transform the input model element to an enumeration
public override void Transform(T input, CodeTypeDeclaration output, ITransformationContext context)
Parameters
input
TThe input model element that is transformed to an enumeration
output
CodeTypeDeclarationThe output code type declaration that represents an enumeration
context
ITransformationContextThe transformation context