C# Класс Onism.Cldr.Tools.JsonParsers.CldrJsonParser

Parses JSONs valid against the schema provided by the derived class.
The contract assumes that any methods from this parser can be called for a certain JSON object only if in the beginning the IsValid method returned "true" for it. The following order of operations is assumed: 1. The ExtractMetadata method is called. 2. The RemoveMetadata method is called. 3. Subsetting is performed (externally). 4. The PrepareForMerging method is called.
Показать файл Открыть проект

Открытые методы

Метод Описание
ExtractMetadata ( Newtonsoft.Json.Linq.JObject obj ) : CldrJsonMetadata

Extracts metadata from the specified JSON object. If no metadata is provided in this type of JSONs, null is returned.

IsValid ( Newtonsoft.Json.Linq.JObject obj ) : bool

Determines whether the JSON object is valid against the schema of this parser. Being valid implies satisfying assumptions on the JSON structure.

PrepareForMerging ( CldrLocale locale, Newtonsoft.Json.Linq.JObject obj ) : CldrJson

Returns a normalized CldrJson object, ready to be merged into CldrTree.

Note that the specified JSON object does not have metadata anymore. What is more, the subsetting step (3rd) might have removed some of its subtrees. It cannot be assumed to be valid against this parser's schema anymore. However, it is assumed that this JSON is the previously valid JSON, but with some of its descendants removed.

RemoveMetadata ( Newtonsoft.Json.Linq.JObject obj ) : void

Removes metadata from the specified JSON object. If no metadata is provided in this type of JSONs, nothing is removed.

Защищенные методы

Метод Описание
CldrJsonParser ( string schema ) : Newtonsoft.Json.Linq

Описание методов

CldrJsonParser() защищенный Метод

protected CldrJsonParser ( string schema ) : Newtonsoft.Json.Linq
schema string
Результат Newtonsoft.Json.Linq

ExtractMetadata() публичный Метод

Extracts metadata from the specified JSON object. If no metadata is provided in this type of JSONs, null is returned.
public ExtractMetadata ( Newtonsoft.Json.Linq.JObject obj ) : CldrJsonMetadata
obj Newtonsoft.Json.Linq.JObject
Результат CldrJsonMetadata

IsValid() публичный Метод

Determines whether the JSON object is valid against the schema of this parser. Being valid implies satisfying assumptions on the JSON structure.
public IsValid ( Newtonsoft.Json.Linq.JObject obj ) : bool
obj Newtonsoft.Json.Linq.JObject
Результат bool

PrepareForMerging() публичный Метод

Returns a normalized CldrJson object, ready to be merged into CldrTree.
Note that the specified JSON object does not have metadata anymore. What is more, the subsetting step (3rd) might have removed some of its subtrees. It cannot be assumed to be valid against this parser's schema anymore. However, it is assumed that this JSON is the previously valid JSON, but with some of its descendants removed.
public PrepareForMerging ( CldrLocale locale, Newtonsoft.Json.Linq.JObject obj ) : CldrJson
locale CldrLocale
obj Newtonsoft.Json.Linq.JObject
Результат CldrJson

RemoveMetadata() публичный Метод

Removes metadata from the specified JSON object. If no metadata is provided in this type of JSONs, nothing is removed.
public RemoveMetadata ( Newtonsoft.Json.Linq.JObject obj ) : void
obj Newtonsoft.Json.Linq.JObject
Результат void