try {
Field declaredField = this.getClass().getDeclaredField(key);
switch (declaredField.getType().toString()) {
case "double":
declaredField.set(this, Double.parseDouble(value));
break;
case "int":
declaredField.set(this, Integer.parseInt(value));
break;
case "class java.lang.String":
declaredField.set(this, value);
break;
}
} /* ... */
function TTCache(){}
TTCache.prototype = {
check : function() {
/* ... */
this.onReady()
},
onReady : function(){}
}
myfunction() {
var ttcache = new TTCache();
ttcache.onReady = function {
/* продолжаем работать */
}
ttcache.check();
}