You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flex.apache.org by ah...@apache.org on 2015/01/23 21:24:23 UTC
[13/14] git commit: [flex-asjs] [refs/heads/develop] - add
getprop/setprop
add getprop/setprop
Project: http://git-wip-us.apache.org/repos/asf/flex-asjs/repo
Commit: http://git-wip-us.apache.org/repos/asf/flex-asjs/commit/74a47a87
Tree: http://git-wip-us.apache.org/repos/asf/flex-asjs/tree/74a47a87
Diff: http://git-wip-us.apache.org/repos/asf/flex-asjs/diff/74a47a87
Branch: refs/heads/develop
Commit: 74a47a87e95eef943d7cb2b7c6f59e1409359405
Parents: 25fd919
Author: Alex Harui <ah...@apache.org>
Authored: Fri Jan 23 12:22:14 2015 -0800
Committer: Alex Harui <ah...@apache.org>
Committed: Fri Jan 23 12:24:05 2015 -0800
----------------------------------------------------------------------
.../org/apache/flex/net/JSONItemConverter.as | 29 ++++++++++++++++++
.../org/apache/flex/net/JSONItemConverter.js | 32 ++++++++++++++++++++
2 files changed, 61 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/74a47a87/frameworks/as/projects/FlexJSUI/src/org/apache/flex/net/JSONItemConverter.as
----------------------------------------------------------------------
diff --git a/frameworks/as/projects/FlexJSUI/src/org/apache/flex/net/JSONItemConverter.as b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/net/JSONItemConverter.as
index d8e1251..5df299a 100644
--- a/frameworks/as/projects/FlexJSUI/src/org/apache/flex/net/JSONItemConverter.as
+++ b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/net/JSONItemConverter.as
@@ -41,5 +41,34 @@ package org.apache.flex.net
data += "}";
return JSON.parse(data);
}
+
+ /**
+ * Get a property from an object.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ protected function getProperty(obj:Object, propName:String):*
+ {
+ if (propName === 'this')
+ return obj;
+
+ return obj[propName];
+ }
+
+ /**
+ * Set a property on an object.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ protected function setProperty(obj:Object, propName:String, value:*):void
+ {
+ obj[propName] = value;
+ }
}
}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/74a47a87/frameworks/js/FlexJS/src/org/apache/flex/net/JSONItemConverter.js
----------------------------------------------------------------------
diff --git a/frameworks/js/FlexJS/src/org/apache/flex/net/JSONItemConverter.js b/frameworks/js/FlexJS/src/org/apache/flex/net/JSONItemConverter.js
index 3ef832c..d405d0a 100644
--- a/frameworks/js/FlexJS/src/org/apache/flex/net/JSONItemConverter.js
+++ b/frameworks/js/FlexJS/src/org/apache/flex/net/JSONItemConverter.js
@@ -46,3 +46,35 @@ org.apache.flex.net.JSONItemConverter.prototype.convertItem = function(s) {
s += '}';
return JSON.parse(s);
};
+
+
+/**
+ * @expose
+ * @param {Object} obj The object.
+ * @param {string} propName The name of the property.
+ * @return {Object} value The value of the property.
+ */
+org.apache.flex.net.JSONItemConverter.prototype.getProperty =
+ function(obj, propName) {
+ if (typeof obj['get_' + propName] === 'function') {
+ return obj['get_' + propName]();
+ }
+ return obj[propName];
+};
+
+
+/**
+ * @expose
+ * @param {Object} obj The object.
+ * @param {string} propName The name of the property.
+ * @param {Object} value The value of the property.
+ */
+org.apache.flex.net.JSONItemConverter.prototype.setProperty =
+function(obj, propName, value) {
+ if (typeof obj['set_' + propName] === 'function') {
+ obj['set_' + propName](value);
+ } else {
+ obj[propName] = value;
+ }
+};
+