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
  
getOptionalProperty(typeName:String, decodedObject:Object, propertyName:String, propertyType:Class = null, 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, propertyType:Class = null):*
[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.
getOptionalProperty()method 
public static function getOptionalProperty(typeName:String, decodedObject:Object, propertyName:String, propertyType:Class = null, defaultValue:*):*

Gets a value of the given property of a JSON-decoded object or a default value if the property value is missing.

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 (case insensitive).
 
propertyType:Class (default = null) — Expected type of property.
 
defaultValue:* (default = NaN) — A default value.

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

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 (case insensitive).
 
propertyType:Class (default = null) — Expected type of property.

Returns
* — Property value.

Throws
BAResponseError — The property is absent or has a wrong type.