19 using System.Collections.Generic;
32 public String
Name {
get;
private set; }
37 public String
Space {
get;
private set; }
60 public SchemaName(String name, String space, String encspace)
67 else if (!name.Contains(
"."))
75 string[] parts = name.Split(
'.');
76 this.
Space =
string.Join(
".", parts, 0, parts.Length - 1);
77 this.
Name = parts[parts.Length - 1];
97 internal void WriteJson(Newtonsoft.Json.JsonTextWriter writer,
SchemaNames names,
string encspace)
99 if (
null != this.
Name)
102 if (!String.IsNullOrEmpty(
this.Space))
103 JsonHelper.writeIfNotNullOrEmpty(writer,
"namespace",
this.Space);
104 else if (!String.IsNullOrEmpty(
this.EncSpace))
105 JsonHelper.writeIfNotNullOrEmpty(writer,
"namespace",
this.EncSpace);
116 if (obj ==
this)
return true;
131 private static bool areEqual(
object obj1,
object obj2)
133 return obj1 ==
null ? obj2 == null : obj1.Equals(obj2);
151 public IDictionary<SchemaName, NamedSchema>
Names {
get;
private set; }
158 Names =
new Dictionary<SchemaName, NamedSchema>();
168 if (
Names.ContainsKey(name))
181 if (
Names.ContainsKey(name))
184 Names.Add(name, schema);
196 return Add(name, schema);
210 return Names.TryGetValue(schemaname, out schema);
219 return Names.GetEnumerator();
String? Fullname
Namespace.Name of the schema
bool TryGetValue(string name, string space, string encspace, out NamedSchema schema)
Tries to get the value for the given name fields
String Name
Name of the schema
IDictionary< SchemaName, NamedSchema > Names
Map of schema name and named schema objects
bool Contains(SchemaName name)
Checks if given name is in the map
override string ToString()
Returns the full name of the schema
String? Namespace
Namespace of the schema
Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements.
SchemaName(String name, String space, String encspace)
Constructor for SchemaName
Class to store schema name, namespace and enclosing namespace
bool Add(NamedSchema schema)
Adds a named schema to the list
A class that contains a list of named schemas.
override int GetHashCode()
override bool Equals(Object obj)
Compares two schema names
bool Add(SchemaName name, NamedSchema schema)
Adds a schema name to the map if it doesn't exist yet
String EncSpace
Namespace from the most tightly enclosing schema
String Space
Namespace specified within the schema
IEnumerator< KeyValuePair< SchemaName, NamedSchema > > GetEnumerator()
Returns the enumerator for the map
Base class for all named schemas: fixed, enum, record
SchemaName SchemaName
Name of the schema, contains name, namespace and enclosing namespace