Packagecom.esri.bacore.client
Classpublic class ParseUtils
InheritanceParseUtils Inheritance Object
Subclasses GPResultParsers, GPResultProcessors

The ParseUtils class contains a collection of static utility methods useful in result parsers.



Public Methods
 MethodDefined By
  
ensureGPResult(decodedObject:Object):void
[static] Ensures that the JSON-decoded object is a GPResult object.
ParseUtils
  
ensureValidGPDataType(decodedObject:Object, value:String):void
[static] Ensures that the dataType property value of the specified JSON-decoded GPResult object is equal to the given value.
ParseUtils
  
getProperty(decodedObject:Object, propertyName:String, ignoreCase:Boolean = false, defaultValue:*):*
[static] Gets a value of the given property of a JSON-decoded object or a default value if the property value is missing.
ParseUtils
  
testAndGetProperty(typeName:String, decodedObject:Object, propertyName:String):*
[static] Tests a property of a JSON-decoded object to be specified and gets it.
ParseUtils
Method Detail
ensureGPResult()method
public static function ensureGPResult(decodedObject:Object):void

Ensures that the JSON-decoded object is a GPResult object.

Parameters

decodedObject:Object — A GPResult object decoded from JSON.


Throws
BAResponseError — The JSON-decoded object has wrong contents.
ensureValidGPDataType()method 
public static function ensureValidGPDataType(decodedObject:Object, value:String):void

Ensures that the dataType property value of the specified JSON-decoded GPResult object is equal to the given value.

Parameters

decodedObject:Object — A GPResult object decoded from JSON.
 
value:String — A value required.


Throws
BAResponseError — GPResult object has a wrong data type.
getProperty()method 
public static function getProperty(decodedObject:Object, propertyName:String, ignoreCase:Boolean = false, defaultValue:*):*

Gets a value of the given property of a JSON-decoded object or a default value if the property value is missing. If ignoreCase is true, the method tries at first to get a property with the given name and after that finds a property in ignore case mode.

Parameters

decodedObject:Object — A JSON-decoded object.
 
propertyName:String — A property of the JSON-decoded object.
 
ignoreCase:Boolean (default = false) — Ignore letter case or not.
 
defaultValue:* (default = NaN) — A default value.

Returns
* — The property value.
testAndGetProperty()method 
public static function testAndGetProperty(typeName:String, decodedObject:Object, propertyName:String):*

Tests a property of a JSON-decoded object to be specified and gets it.

Parameters

typeName:String — A name of type corresponding to this object.
 
decodedObject:Object — A JSON-decoded object.
 
propertyName:String — A property of the JSON-decoded object to be tested.

Returns
* — Property value.

Throws
BAResponseError — The property is absent.