Class CodeGen
Inheritance
Inherited Members
Namespace: Avro
Assembly: Avro.dll
Syntax
public class CodeGen
Constructors
| Improve this Doc View SourceCodeGen()
Default constructor
Declaration
public CodeGen()
Fields
| Improve this Doc View SourcenamespaceLookup
List of generated namespaces
Declaration
protected Dictionary<string, CodeNamespace> namespaceLookup
Field Value
Type | Description |
---|---|
System.Collections.Generic.Dictionary<System.String, System.CodeDom.CodeNamespace> |
Properties
| Improve this Doc View SourceCompileUnit
Object that contains all the generated types
Declaration
public CodeCompileUnit CompileUnit { get; }
Property Value
Type | Description |
---|---|
System.CodeDom.CodeCompileUnit |
Protocols
List of protocols to generate code for
Declaration
public IList<Protocol> Protocols { get; }
Property Value
Type | Description |
---|---|
System.Collections.Generic.IList<Protocol> |
Schemas
List of schemas to generate code for
Declaration
public IList<Schema> Schemas { get; }
Property Value
Type | Description |
---|---|
System.Collections.Generic.IList<Schema> |
Methods
| Improve this Doc View SourceaddName(Schema, SchemaNames)
Recursively search the given schema for named schemas and adds them to the given container
Declaration
protected virtual void addName(Schema schema, SchemaNames names)
Parameters
Type | Name | Description |
---|---|---|
Schema | schema | schema object to search |
SchemaNames | names | list of named schemas |
addNamespace(String)
Adds a namespace object for the given name into the dictionary if it doesn't exist yet
Declaration
protected virtual CodeNamespace addNamespace(string name)
Parameters
Type | Name | Description |
---|---|---|
System.String | name | name of namespace |
Returns
Type | Description |
---|---|
System.CodeDom.CodeNamespace |
AddProtocol(Protocol)
Adds a protocol object to generate code for
Declaration
public virtual void AddProtocol(Protocol protocol)
Parameters
Type | Name | Description |
---|---|---|
Protocol | protocol | protocol object |
AddSchema(Schema)
Adds a schema object to generate code for
Declaration
public virtual void AddSchema(Schema schema)
Parameters
Type | Name | Description |
---|---|---|
Schema | schema | schema object |
createDocComment(String)
Creates an XML documentation for the given comment
Declaration
protected virtual CodeCommentStatement createDocComment(string comment)
Parameters
Type | Name | Description |
---|---|---|
System.String | comment | comment |
Returns
Type | Description |
---|---|
System.CodeDom.CodeCommentStatement | CodeCommentStatement object |
createSchemaField(Schema, CodeTypeDeclaration, Boolean)
Creates the static schema field for class types
Declaration
protected virtual void createSchemaField(Schema schema, CodeTypeDeclaration ctd, bool overrideFlag)
Parameters
Type | Name | Description |
---|---|---|
Schema | schema | schema |
System.CodeDom.CodeTypeDeclaration | ctd | CodeTypeDeclaration for the class |
System.Boolean | overrideFlag |
GenerateCode()
Generates code for the given protocol and schema objects
Declaration
public virtual CodeCompileUnit GenerateCode()
Returns
Type | Description |
---|---|
System.CodeDom.CodeCompileUnit | CodeCompileUnit object |
generateNames(Protocol)
Generate list of named schemas from given protocol
Declaration
protected virtual SchemaNames generateNames(Protocol protocol)
Parameters
Type | Name | Description |
---|---|---|
Protocol | protocol | protocol to process |
Returns
Type | Description |
---|---|
SchemaNames |
generateNames(Schema)
Generate list of named schemas from given schema
Declaration
protected virtual SchemaNames generateNames(Schema schema)
Parameters
Type | Name | Description |
---|---|---|
Schema | schema | schema to process |
Returns
Type | Description |
---|---|
SchemaNames |
getNullableType(UnionSchema)
Gets the schema of a union with null
Declaration
public static Schema getNullableType(UnionSchema schema)
Parameters
Type | Name | Description |
---|---|---|
UnionSchema | schema | union schema |
Returns
Type | Description |
---|---|
Schema | schema that is nullible |
processEnum(Schema)
Creates an enum declaration
Declaration
protected virtual void processEnum(Schema schema)
Parameters
Type | Name | Description |
---|---|---|
Schema | schema | enum schema |
processFixed(Schema)
Creates a class declaration for fixed schema
Declaration
protected virtual void processFixed(Schema schema)
Parameters
Type | Name | Description |
---|---|---|
Schema | schema | fixed schema |
processInterface(Protocol)
Declaration
protected virtual void processInterface(Protocol protocol)
Parameters
Type | Name | Description |
---|---|---|
Protocol | protocol |
processProtocols()
Generates code for the protocol objects
Declaration
protected virtual void processProtocols()
processRecord(Schema)
Creates a class declaration
Declaration
protected virtual CodeTypeDeclaration processRecord(Schema schema)
Parameters
Type | Name | Description |
---|---|---|
Schema | schema | record schema |
Returns
Type | Description |
---|---|
System.CodeDom.CodeTypeDeclaration |
processSchemas()
Generates code for the schema objects
Declaration
protected virtual void processSchemas()
WriteCompileUnit(String)
Writes the generated compile unit into one file
Declaration
public virtual void WriteCompileUnit(string outputFile)
Parameters
Type | Name | Description |
---|---|---|
System.String | outputFile | name of output file to write to |
WriteTypes(String)
Writes each types in each namespaces into individual files
Declaration
public virtual void WriteTypes(string outputdir)
Parameters
Type | Name | Description |
---|---|---|
System.String | outputdir | name of directory to write to |