And here is the sum up version, implemented by a mixin which could be 
added somewhere in the class hierarchy, or may even be applied to an 
existing class hierarchy by using qx.Class.patch:


qx.Mixin.define("MCallGetter",
{
   members :
   {
     callGetter : function(propertyName) {
       var methodName = 'get'+qx.lang.String.firstUp(propertyName);

       if(qx.lang.Type.isFunction(object[methodName])) {
         value = object[methodName].call(object);
         return value;
       }
       else {
         return null;
       }
   }
});


All object instances of classes having the mixin may now simply execute:

     var value = object.callGetter('dewpoint');


Regards
Dietrich



Am 16.02.2015 um 08:55 schrieb Dietrich Streifert:
> qooxdoo brings It's own method for capitalizing the first letter of a 
> string, so you would write:
>
>     var methodName = 'get'+qx.lang.String.firstUp(theRawPropertyID);
>
> You could even be smarter by checking if the "introspected" method is 
> a function:
>
>     if(qx.lang.Type.isFunction(object[methodName])) {
>         value = object[methodName].call(object);
>         return value;
>     }
>     else {
>         return null;
>     }


------------------------------------------------------------------------------
Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server
from Actuate! Instantly Supercharge Your Business Reports and Dashboards
with Interactivity, Sharing, Native Excel Exports, App Integration & more
Get technology previously reserved for billion-dollar corporations, FREE
http://pubads.g.doubleclick.net/gampad/clk?id=190641631&iu=/4140/ostg.clktrk
_______________________________________________
qooxdoo-devel mailing list
qooxdoo-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel

Reply via email to