Avro C#
Public Member Functions | Static Public Member Functions | Properties | List of all members
Avro.EnumSchema Class Reference

Class for enum type schemas More...

Inheritance diagram for Avro.EnumSchema:
Avro.NamedSchema Avro.Schema

Public Member Functions

int Ordinal (string symbol)
 Returns the position of the given symbol within this enum. Throws AvroException if the symbol is not found in this enum. More...
 
bool Contains (string symbol)
 Checks if given symbol is in the list of enum symbols More...
 
IEnumerator< string > GetEnumerator ()
 Returns an enumerator that enumerates the symbols in this enum schema in the order of their definition. More...
 
override bool Equals (object obj)
 Checks equality of two enum schema More...
 
override int GetHashCode ()
 Hashcode function More...
 
override bool CanRead (Schema writerSchema)
 Checks if this schema can read data written by the given schema. Used for decoding data. More...
 
- Public Member Functions inherited from Avro.Schema
override string ToString ()
 Returns the canonical JSON representation of this schema. More...
 
string GetProperty (string key)
 Returns the schema's custom property value given the property name More...
 
override int GetHashCode ()
 Hash code function More...
 

Static Public Member Functions

static EnumSchema Create (string name, IEnumerable< string > symbols, string space=null, IEnumerable< string > aliases=null, PropertyMap customProperties=null, string doc=null, string defaultSymbol=null)
 Initializes a new instance of the EnumSchema class. More...
 
- Static Public Member Functions inherited from Avro.Schema
static Schema Parse (string json)
 Parses a given JSON string to create a new schema object More...
 
static string GetTypeString (Type type)
 Returns symbol name for the given schema type More...
 
static Schema.? Type ParseType (string type, bool removeQuotes=false)
 Parses the Schema.Type from a string. More...
 

Properties

IList< string > Symbols [get]
 List of strings representing the enum symbols More...
 
string Default [get]
 The default token to use when deserializing an enum when the provided token is not found More...
 
int Count [get]
 Count of enum symbols More...
 
string this[int index] [get]
 Returns the enum symbol of the given index to the list More...
 
- Properties inherited from Avro.NamedSchema
SchemaName SchemaName [get]
 Name of the schema, contains name, namespace and enclosing namespace More...
 
override string Name [get]
 Name of the schema More...
 
string Namespace [get]
 Namespace of the schema More...
 
override string Fullname [get]
 Namespace.Name of the schema More...
 
string Documentation [get]
 Documentation for the schema, if any. Null if there is no documentation. More...
 
- Properties inherited from Avro.Schema
Type Tag [get]
 Schema type property More...
 
abstract string Name [get]
 If this is a record, enum or fixed, returns its name, otherwise the name the primitive type. More...
 
virtual string Fullname [get]
 The name of this schema. If this is a named schema such as an enum, it returns the fully qualified name for the schema. For other schemas, it returns the type of the schema. More...
 

Additional Inherited Members

- Public Types inherited from Avro.Schema
enum  Type {
  Type.Null, Type.Boolean, Type.Int, Type.Long,
  Type.Float, Type.Double, Type.Bytes, Type.String,
  Type.Record, Type.Enumeration, Type.Array, Type.Map,
  Type.Union, Type.Fixed, Type.Error, Type.Logical
}
 Enum for schema types More...
 
- Protected Member Functions inherited from Avro.NamedSchema
 NamedSchema (Type type, SchemaName name, IList< SchemaName > aliases, PropertyMap props, SchemaNames names, string doc)
 Constructor for named schema class More...
 
bool InAliases (SchemaName name)
 Determines whether the given schema name is one of this NamedSchema's aliases. More...
 
- Protected Member Functions inherited from Avro.Schema
 Schema (Type type, PropertyMap props)
 Constructor for schema class More...
 
- Static Protected Member Functions inherited from Avro.NamedSchema
static SchemaName GetName (JToken jtok, string encspace)
 Parses the name and namespace from the given JSON schema object then creates SchemaName object including the given enclosing namespace More...
 
static IList< SchemaNameGetAliases (JToken jtok, string space, string encspace)
 Parses the 'aliases' property from the given JSON token More...
 
- Static Protected Member Functions inherited from Avro.Schema
static bool areEqual (object o1, object o2)
 Compares two objects, null is equal to null More...
 
static int getHashCode (object obj)
 Hash code helper function More...
 

Detailed Description

Class for enum type schemas

Member Function Documentation

◆ CanRead()

override bool Avro.EnumSchema.CanRead ( Schema  writerSchema)
inlinevirtual

Checks if this schema can read data written by the given schema. Used for decoding data.

Parameters
writerSchemawriter schema
Returns
true if this and writer schema are compatible based on the AVRO specification, false otherwise

Reimplemented from Avro.Schema.

◆ Contains()

bool Avro.EnumSchema.Contains ( string  symbol)
inline

Checks if given symbol is in the list of enum symbols

Parameters
symbolsymbol to check
Returns
true if symbol exist, false otherwise

◆ Create()

static EnumSchema Avro.EnumSchema.Create ( string  name,
IEnumerable< string >  symbols,
string  space = null,
IEnumerable< string >  aliases = null,
PropertyMap  customProperties = null,
string  doc = null,
string  defaultSymbol = null 
)
inlinestatic

Initializes a new instance of the EnumSchema class.

Parameters
nameName of enum
spaceNamespace of enum
aliasesList of aliases for the name
symbolsList of enum symbols
customPropertiesCustom properties on this schema
docDocumentation for this named schema
defaultSymbol

◆ Equals()

override bool Avro.EnumSchema.Equals ( object  obj)
inline

Checks equality of two enum schema

Parameters
obj
Returns

◆ GetEnumerator()

IEnumerator<string> Avro.EnumSchema.GetEnumerator ( )
inline

Returns an enumerator that enumerates the symbols in this enum schema in the order of their definition.

Returns
Enumeration over the symbols of this enum schema

◆ GetHashCode()

override int Avro.EnumSchema.GetHashCode ( )
inline

Hashcode function

Returns

◆ Ordinal()

int Avro.EnumSchema.Ordinal ( string  symbol)
inline

Returns the position of the given symbol within this enum. Throws AvroException if the symbol is not found in this enum.

Parameters
symbolname of the symbol to find
Returns
position of the given symbol in this enum schema
Exceptions
Avro.AvroExceptionNo such symbol: {symbol}

Property Documentation

◆ Count

int Avro.EnumSchema.Count
get

Count of enum symbols

◆ Default

string Avro.EnumSchema.Default
get

The default token to use when deserializing an enum when the provided token is not found

◆ Symbols

IList<string> Avro.EnumSchema.Symbols
get

List of strings representing the enum symbols

◆ this[int index]

string Avro.EnumSchema.this[int index]
get

Returns the enum symbol of the given index to the list

Parameters
indexsymbol index
Returns
symbol name

The documentation for this class was generated from the following file: