public function TypeValidator()
TypeValidator Static Constructor
public static function compare(o1:*, o2:*):Boolean
Compares the types of two objects.
Parameters
Returns
| Boolean — true if the two objects are the same primitive type.
|
public static function isBoolean(str:String):Boolean
Check if the passed-in string is a Boolean.
Parameters
Returns
| Boolean — true if the passed-in object is a Boolean.
|
See also
public static function isExplicitInstanceOf(o:*, c:*):Boolean
Checks if the passed-in object is an explicit instance of the passed-in class.
Parameters
Returns
| Boolean — true if the passed-in object is an explicit instance of the passed-in class.
|
public static function isGenericObject(o:*):Boolean
Checks if the passed-in object is a generic object.
Parameters
Returns
| Boolean — true if the passed-in object is a generic object.
|
public static function isHex(str:String):Boolean
Check if the passed-in string is an hexidecimal value.
Parameters
Returns
| Boolean — true if the passed-in object is a hexidecimal value.
|
public static function isInstanceOf(o:*, type:*):Boolean
Checks if the passed-in object is an instance of the passed-in type.
Parameters
Returns
| Boolean — true if the passed-in object is an instance of the passed-in type.
|
public static function isNumber(str:String):Boolean
Check if the passed-in string is a Number.
Parameters
Returns
| Boolean — true if the passed-in object is a Number.
|
public static function isOctal(str:String):Boolean
Check if the passed-in string is an octal value.
Parameters
Returns
| Boolean — true if the passed-in object is a octal value.
|
public static function isPassedByReference(o:*):Boolean
Checks if a class instance
is a non-primitive type which
will be copied by reference (e.g. a pointer to the existing object) or by value (e.g. a new object).
Parameters
| o:* — - the object to be validated
|
Returns
| Boolean — true if instance is not a primitive value or is null .
|
public static function isPassedByValue(o:*):Boolean
Checks if a class instance
is a primitive type which
will be copied by value (e.g. a new object) or by reference (pointer).
Parameters
| o:* — - the object to be validated
|
Returns
| Boolean — true if instance is a primitive value & not null .
|
public static function isPrimitive(o:*):Boolean
Checks if the passed-in object is a primitive type.
Parameters
Returns
| Boolean — true if the passed-in object is a primitive type.
|
public static function isTypeOf(o:*, type:String):Boolean
Checks if the result of an execution of the typeof method on the passed-in object matches the passed-in type.
Parameters
Returns
| Boolean — true if the result of an execution of the typeof method on the passed-in object matches the passed-in type.
|
public static function strictIs(instance:Object, compareClass:Class):Boolean
Checks the class of instance
against the compareClass
for strict
equality. If the classes are exactly the same, returns true. If
the classes are different even if the instance
's class is a subclass
of compareClass
, it returns false.
Does not work with interfaces. The compareClass must be a class.
Parameters
| instance:Object — - the object whos class you want to check.
|
|
| compareClass:Class — - the class to compare your object against.
|
Returns
| Boolean — true if instance is strictly of type compareClass.
|
Example
var myBase:BaseClass = new BaseClass();
var mySub:SubClass = new SubClass();
trace(strictIs(myBase, BaseClass)); // true
trace(strictIs(mySub, SubClass)); // true
trace(strictIs(mySub, BaseClass)); // false
public static function typesMatch(o:*, type:*):Boolean
Checks if the type of the passed-in object matches the passed-in type.
Parameters
Returns
Example
import sekati.validate.TypeValidation;
var s1:String = "hello world";
var s2:String = new String("hello world");
trace("s1 is string : " + TypeValidation.typesMatch( s1, String )); // output : 'true'
trace("s2 is string : " + TypeValidation.typesMatch( s2, String )); // output : 'true'
public static const BOOLEAN:String = "boolean"
public static const DATE:String = "date"
public static const ERROR:String = "error"
public static const FUNCTION:String = "function"
public static const INT:String = "int"
protected static const IS_BOOLEAN:RegExp
protected static const IS_HEX:RegExp
protected static const IS_NUMBER:RegExp
protected static const IS_OCTAL:RegExp
public static const NULL:String = "null"
public static const NUMBER:String = "number"
public static const OBJECT:String = "object"
public static const STRING:String = "string"
public static const UINT:String = "uint"
public static const UNDEFINED:String = "undefined"
public static const XML:String = "xml"
Copyright © 2008-2012 jason m horwitz, Sekati LLC. All Rights Reserved.