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.
Afficher le fichier Open project: pgolebiowski/onism-cldr

Méthodes publiques

Méthode 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.

Méthodes protégées

Méthode Description
CldrJsonParser ( string schema ) : Newtonsoft.Json.Linq

Method Details

CldrJsonParser() protected méthode

protected CldrJsonParser ( string schema ) : Newtonsoft.Json.Linq
schema string
Résultat Newtonsoft.Json.Linq

ExtractMetadata() public méthode

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
Résultat CldrJsonMetadata

IsValid() public méthode

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
Résultat bool

PrepareForMerging() public méthode

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
Résultat CldrJson

RemoveMetadata() public méthode

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
Résultat void