19 using System.Collections.Generic;
    21 using Newtonsoft.Json.Linq;
    22 using Newtonsoft.Json;
    45         public readonly 
string Name;
    55         public int Pos { 
get; 
private set; }
    88         internal static JTokenEqualityComparer JtokenEqual = 
new JTokenEqualityComparer();
   105         internal Field(
Schema schema, 
string name, IList<string> 
aliases, 
int pos, 
string doc,
   108             if (
string.IsNullOrEmpty(name)) 
throw new ArgumentNullException(
"name", 
"name cannot be null.");
   109             if (
null == schema) 
throw new ArgumentNullException(
"type", 
"type cannot be null.");
   128             writer.WriteStartObject();
   129             JsonHelper.writeIfNotNullOrEmpty(writer, 
"name", this.Name);
   134                 writer.WritePropertyName(
"default");
   139                 writer.WritePropertyName(
"type");
   143             if (
null != this.Props)
   144                 this.Props.WriteJson(writer);
   148                 writer.WritePropertyName(
"aliases");
   149                 writer.WriteStartArray();
   150                 foreach (
string name 
in aliases)
   151                     writer.WriteValue(name);
   152                 writer.WriteEndArray();
   155             writer.WriteEndObject();
   163         internal static IList<string> GetAliases(JToken jtok)
   165             JToken jaliases = jtok[
"aliases"];
   166             if (
null == jaliases)
   169             if (jaliases.Type != JTokenType.Array)
   172             var 
aliases = 
new List<string>();
   173             foreach (JToken jalias 
in jaliases)
   175                 if (jalias.Type != JTokenType.String)
   190             if (
null == this.Props) 
return null;
   192             return (this.Props.TryGetValue(key, out v)) ? v : 
null;
   202             if (obj == 
this) 
return true;
   203             if (obj != 
null && obj is 
Field)
   208                     && that.
Schema.Equals(
Schema) && areEqual(that.Props, 
this.Props);
   219         private static bool areEqual(
object o1, 
object o2)
   221             return o1 == 
null ? o2 == null : o1.Equals(o2);
   232                    37 * getHashCode(Props);
   240         private static int getHashCode(
object obj)
   242             return obj == 
null ? 0 : obj.GetHashCode();
 Schema Schema
Field type's schema
 
Class for fields defined in a record
 
override int GetHashCode()
Hash code function
 
SortOrder
Enum for the sorting order of record fields
 
int Pos
Position of the field within its record.
 
Base class for all schema types
 
string GetProperty(string key)
Returns the field's custom property value given the property name
 
readonly string Name
Name of the field.
 
virtual internal void WriteJson(JsonTextWriter writer, SchemaNames names, string encspace)
Writes schema object in JSON format
 
Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements.
 
readonly IList< string > aliases
List of aliases for the field name
 
override int GetHashCode()
Hash code function
 
SortOrder? Ordering
Order of the field
 
A class that contains a list of named schemas.
 
JToken DefaultValue
The default value for the field stored as JSON object, if defined.
 
string Documentation
Documentation for the field, if any.
 
internal void writeJson(JsonTextWriter writer, SchemaNames names, string encspace)
Writes the Field class in JSON format
 
override bool Equals(object obj)
Compares two field objects