19 using System.Collections.Generic;
21 using Newtonsoft.Json.Linq;
33 public int Size {
get;
set; }
57 private FixedSchema(
SchemaName name, IList<SchemaName> aliases,
int size, PropertyMap props, SchemaNames names)
58 : base(
Type.Fixed, name, aliases, props, names)
60 if (
null == name.Name)
throw new SchemaParseException(
"name cannot be null for fixed schema.");
61 if (size <= 0)
throw new ArgumentOutOfRangeException(
"size",
"size must be greater than zero.");
73 base.WriteJsonFields(writer, names, encspace);
74 writer.WritePropertyName(
"size");
75 writer.WriteValue(this.
Size);
83 public override bool Equals(
object obj)
85 if (obj ==
this)
return true;
111 if (writerSchema.
Tag !=
Tag)
return false;
113 if (that.
Size !=
Size)
return false;
static SchemaName GetName(JToken jtok, string encspace)
Parses the name and namespace from the given JSON schema object then creates SchemaName object includ...
static int getHashCode(object obj)
Hash code helper function
override bool Equals(object obj)
Compares two fixed schemas
static IList< SchemaName > GetAliases(JToken jtok, string space, string encspace)
Parses the 'aliases' property from the given JSON token
bool InAliases(SchemaName name)
Base class for all schema types
override int GetHashCode()
Hash code function
Type
Enum for schema types
int Size
Fixed size for the bytes
Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements.
Class to store schema name, namespace and enclosing namespace
A class that contains a list of named schemas.
override int GetHashCode()
override bool Equals(Object obj)
Compares two schema names
override bool CanRead(Schema writerSchema)
Checks if this schema can read data written by the given schema.
String EncSpace
Namespace from the most tightly enclosing schema
static bool areEqual(object o1, object o2)
Compares two objects, null is equal to null
String Space
Namespace specified within the schema
internal override void WriteJsonFields(Newtonsoft.Json.JsonTextWriter writer, SchemaNames names, string encspace)
Writes the fixed schema class in JSON format
Type Tag
Schema type property
static int GetRequiredInteger(JToken jtok, string field)
Retrieves the required int property value for the given property name from the given JSON object.
Base class for all named schemas: fixed, enum, record
SchemaName SchemaName
Name of the schema, contains name, namespace and enclosing namespace