void DataSourceInterface::assignId(DataSourceEntityMapping& dsemp, ClassInfo& clas, void* entity) { GenericObject idv; next(dsemp, idv); if(!idv.isNull()) { Field fld = clas.getField(dsemp.getIdPropertyName()); vector<void *> valus; if(GenericObject::isNumber32(idv.getTypeName()) && GenericObject::isNumber(fld.getType())) { long* id; idv.get(id); valus.push_back(id); } else if(GenericObject::isNumber64(idv.getTypeName()) && GenericObject::isNumber(fld.getType())) { long long* id; idv.get(id); valus.push_back(id); } else if(GenericObject::isFPN(idv.getTypeName()) && GenericObject::isFPN(fld.getType())) { long double* id; idv.get(id); valus.push_back(id); } else if(GenericObject::isString(idv.getTypeName()) && GenericObject::isString(fld.getType())) { string* id; idv.set(id); valus.push_back(id); } else { throw "Data-Source-Object/Entity types do not match for id property" + dsemp.getClassName() + ":" + dsemp.getIdPropertyName(); } args argus; argus.push_back(fld.getType()); string methname = "set"+StringUtil::capitalizedCopy(fld.getFieldName()); Method meth = clas.getMethod(methname,argus); reflector->invokeMethodGVP(entity,meth,valus); } }
bool CacheInterface::set(const std::string& key, const int& value, const int& expireSeconds) { GenericObject ob; ob.set(value); bool status = set(key, ob, expireSeconds); return status; }
bool CacheInterface::replace(const std::string& key, const unsigned short& value, const int& expireSeconds) { GenericObject ob; ob.set(value); bool status = replace(key, ob, expireSeconds); return status; }