开发者

generic identifier

开发者 https://www.devze.com 2023-01-01 21:37 出处:网络
as I probably do not describe the problem in the right terms, I was not able to get an answer with google. Please excuse!

as I probably do not describe the problem in the right terms, I was not able to get an answer with google. Please excuse!

In the following code, I would like to replace 'hardcoded' identifier COMMENT with the variable e开发者_开发技巧ditedField. How to do that?

var editedField:String = event.dataField;
if (model.multipleProcessingData[i][editedInformationProductNO].COMMENT != null{
    ...
}


Make sure you wrap this in try/catch block for NPE's, as you'll eventually find one with this many [] accessors.

A better, more OOP, would be to have an accessor function on your model that you can pass your data to: model.getEditedField(i, editedInformatioNProductNO, editedField)

This will make it easier to troubleshoot and add good error messages to your app if things don't turn out like you expected.


var editedField:String = event.dataField;

if (model.multipleProcessingData[i][editedInformationProductNO][editedField] != null{

...

}

0

精彩评论

暂无评论...
验证码 换一张
取 消