Show / Hide Table of Contents

Class CodeGen

Inheritance
System.Object
CodeGen
Inherited Members
System.Object.ToString()
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
Namespace: Avro
Assembly: Avro.dll
Syntax
public class CodeGen

Constructors

| Improve this Doc View Source

CodeGen()

Default constructor

Declaration
public CodeGen()

Fields

| Improve this Doc View Source

namespaceLookup

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 Source

CompileUnit

Object that contains all the generated types

Declaration
public CodeCompileUnit CompileUnit { get; }
Property Value
Type Description
System.CodeDom.CodeCompileUnit
| Improve this Doc View Source

Protocols

List of protocols to generate code for

Declaration
public IList<Protocol> Protocols { get; }
Property Value
Type Description
System.Collections.Generic.IList<Protocol>
| Improve this Doc View Source

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 Source

addName(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

| Improve this Doc View Source

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
| Improve this Doc View Source

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

| Improve this Doc View Source

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

| Improve this Doc View Source

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

| Improve this Doc View Source

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
| Improve this Doc View Source

GenerateCode()

Generates code for the given protocol and schema objects

Declaration
public virtual CodeCompileUnit GenerateCode()
Returns
Type Description
System.CodeDom.CodeCompileUnit

CodeCompileUnit object

| Improve this Doc View Source

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
| Improve this Doc View Source

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
| Improve this Doc View Source

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

| Improve this Doc View Source

processEnum(Schema)

Creates an enum declaration

Declaration
protected virtual void processEnum(Schema schema)
Parameters
Type Name Description
Schema schema

enum schema

| Improve this Doc View Source

processFixed(Schema)

Creates a class declaration for fixed schema

Declaration
protected virtual void processFixed(Schema schema)
Parameters
Type Name Description
Schema schema

fixed schema

| Improve this Doc View Source

processInterface(Protocol)

Declaration
protected virtual void processInterface(Protocol protocol)
Parameters
Type Name Description
Protocol protocol
| Improve this Doc View Source

processProtocols()

Generates code for the protocol objects

Declaration
protected virtual void processProtocols()
| Improve this Doc View Source

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
| Improve this Doc View Source

processSchemas()

Generates code for the schema objects

Declaration
protected virtual void processSchemas()
| Improve this Doc View Source

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

| Improve this Doc View Source

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

  • Improve this Doc
  • View Source
Back to top Copyright © 2012 The Apache Software Foundation.