Thank you for pointing me the debug things. It will be helpfull not to 
overload client with unnecessary check on released apps.
Best,
Sylvain

Le 07/09/2011 10:11, Seldaiendil D. Flourite a écrit :
> Of course you have it, it is at qx.core.Assert.assertInstance(var
> |value|, Class <http://demo.qooxdoo.org/1.5.x/apiviewer/#qx.core.Class>
> |clazz|, String
> <https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/String>
> |msg|)
>
> You can write methods like:
>
> qx.Class.define('myapp.MyClass', {
>    extend: qx.core.Object,
>
>    members: {
>      method: function(arg1) {
>        if (qx.core.Environment.get('qx.debug')) {
>          qx.core.Assert.assertInstance(arg1, myapp.AnotherClass,
> "Argument arg1 must be a instance of myapp.AnotherClass!");
>        }
>      }
>    }
> });
>
> I recommend you to use qx.debug so this code won't execute on release
> mode, only while debugging.
>
> *
> *
> 2011/9/7 Sylvain Gaillard <[email protected]
> <mailto:[email protected]>>
>
>     Hi all of you,
>     I'm writing some classes dealing with biological data and coming from
>     C++ I'm used to have check on the type of my incoming function
>     parameters. How, in qooxdoo, can I check this type?
>     I've found the qx.core.Assert class and I'm looking for something like
>     the assertQxObject but on any type of sub-QxObject. In fact, looking at
>     the implementation I've found that the qx.core.Assert.__isQxInstance
>     function does exactly what I'm looking for. Why not implementing an
>     assert like assertQxInstance(value, className, msg)? Or is there
>     something like that anywhere in the framework that I've not seen?
>     I know I can use Interfaces and assert the implementation of interfaces
>     in my incoming objects but in simple cases it's simpler to check class
>     type than writing interfaces for each concept and then writing classes
>     to implement them.
>     Best,
>     Sylvain


------------------------------------------------------------------------------
Using storage to extend the benefits of virtualization and iSCSI
Virtualization increases hardware utilization and delivers a new level of
agility. Learn what those decisions are and how to modernize your storage 
and backup environments for virtualization.
http://www.accelacomm.com/jaw/sfnl/114/51434361/
_______________________________________________
qooxdoo-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel

Reply via email to