Packageorg.pranaframework.utils
Classpublic class Assert

Assertion utility class that assists in validating arguments. Useful for identifying programmer errors early and clearly at runtime. Note: this class is based on the Assert class in java's Spring framework.

See also

http://fisheye1.cenqua.com/browse/~raw,r=1.27/springframework/spring/src/org/springframework/util/Assert.java


Public Methods
 MethodDefined by
  
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
  
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
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
— if the object is not an instance of the given type
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
— 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 = "")