C# Class 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.
显示文件 Open project: pgolebiowski/onism-cldr

Public Methods

Method Description
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.

Protected Methods

Method Description
CldrJsonParser ( string schema ) : Newtonsoft.Json.Linq

Method Details

CldrJsonParser() protected method

protected CldrJsonParser ( string schema ) : Newtonsoft.Json.Linq
schema string
return Newtonsoft.Json.Linq

ExtractMetadata() public method

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
return CldrJsonMetadata

IsValid() public method

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
return bool

PrepareForMerging() public method

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
return CldrJson

RemoveMetadata() public method

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
return void