Packageorg.springextensions.actionscript.utils
Classpublic class Assert

Assertion utility class that assists in validating arguments. Useful for identifying programmer errors early and clearly at runtime.



Public Methods
 MethodDefined by
  
arrayContains(array:Array, item:String, message:*):void
[static] Assert that the array contains the passed in item.
Assert
  
dictionaryKeysOfType(dictionary:Dictionary, type:Class, message:String = ""):void
[static] Assert that the given Dictionary contains only keys of the given type.
Assert
  
hasText(string:String, message:String = ""):void
[static] Assert that the given String has valid text content; that is, it must not be null and must contain at least one non-whitespace character.
Assert
  
implementationOf(object:*, interfaze:Class, message:String = ""):void
[static] Assert that an object implements a certain interface.
Assert
  
instanceOf(object:*, type:Class, message:String = ""):void
[static] Assert that an object is an instance of a certain type..
Assert
  
isTrue(expression:Boolean, message:String = ""):void
[static] Asserts a boolean expression to be true.
Assert
  
notNull(object:Object, message:String = ""):void
[static] Assert that an object is null.
Assert
  
state(expression:Boolean, message:String = ""):void
[static] Assert a boolean expression to be true.
Assert
  
subclassOf(clazz:Class, parentClass:Class, message:String = ""):void
[static] Asserts that a class is a subclass of another class.
Assert
Method detail
arrayContains()method
public static function arrayContains(array:Array, item:String, message:*):void

Assert that the array contains the passed in item.

Parameters
array:Array
 
item:String
 
message:*
dictionaryKeysOfType()method 
public static function dictionaryKeysOfType(dictionary:Dictionary, type:Class, message:String = ""):void

Assert that the given Dictionary contains only keys of the given type.

Parameters
dictionary:Dictionary
 
type:Class
 
message:String (default = "")
hasText()method 
public static function hasText(string:String, message:String = ""):void

Assert that the given String has valid text content; that is, it must not be null and must contain at least one non-whitespace character.

Parameters
string:String — the String to check
 
message:String (default = "") — the exception message to use if the assertion fails

See also

implementationOf()method 
public static function implementationOf(object:*, interfaze:Class, message:String = ""):void

Assert that an object implements a certain interface.

Parameters
object:*
 
interfaze:Class
 
message:String (default = "")
instanceOf()method 
public static function instanceOf(object:*, type:Class, message:String = ""):void

Assert that an object is an instance of a certain type..

Assert.instanceOf(value, type, "The value must be an instance of 'type'");

Parameters
object:* — the object to check
 
type:Class — the error message to use if the assertion fails
 
message:String (default = "")

Throws
IllegalArgumentError — if the object is not an instance of the given type
isTrue()method 
public static function isTrue(expression:Boolean, message:String = ""):void

Asserts a boolean expression to be true.

Assert.isTrue(value, "The expression must be true");

Parameters
expression:Boolean — a boolean expression
 
message:String (default = "") — the error message to use if the assertion fails

Throws
IllegalArgumentError — if the expression is not true
notNull()method 
public static function notNull(object:Object, message:String = ""):void

Assert that an object is null.

Assert.isNull(value, "The value must be null");

Parameters
object:Object — the object to check
 
message:String (default = "") — the error message to use if the assertion fails

Throws
IllegalArgumentError — if the object is not null
state()method 
public static function state(expression:Boolean, message:String = ""):void

Assert a boolean expression to be true. If false, an IllegalStateError is thrown.

Parameters
expression:Boolean — a boolean expression
 
message:String (default = "") — error message if the assertion fails
subclassOf()method 
public static function subclassOf(clazz:Class, parentClass:Class, message:String = ""):void

Asserts that a class is a subclass of another class.

Parameters
clazz:Class
 
parentClass:Class
 
message:String (default = "")