From 97c5399c9bfdea339cd533523cc8749cf6c5a73d Mon Sep 17 00:00:00 2001 From: hns Date: Fri, 12 Aug 2005 13:27:26 +0000 Subject: [PATCH] Implement getPrototypeProperties(String) to get a SystemMap containing the scripted properties of a prototype. --- src/helma/scripting/rhino/RhinoCore.java | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/src/helma/scripting/rhino/RhinoCore.java b/src/helma/scripting/rhino/RhinoCore.java index aecaf02b..b42f3af4 100644 --- a/src/helma/scripting/rhino/RhinoCore.java +++ b/src/helma/scripting/rhino/RhinoCore.java @@ -419,6 +419,25 @@ public final class RhinoCore implements ScopeProvider { return type == null ? null : type.objProto; } + /** + * Get an array containing the property ids of all properties that were + * compiled from scripts for the given prototype. + * + * @param protoName the name of the prototype + * @return an array containing all compiled properties of the given prototype + */ + public Map getPrototypeProperties(String protoName) { + TypeInfo type = getPrototypeInfo(protoName); + SystemMap map = new SystemMap(); + Iterator it = type.compiledProperties.iterator(); + while(it.hasNext()) { + Object key = it.next(); + if (key instanceof String) + map.put(key, type.objProto.get((String) key, type.objProto)); + } + return map; + } + /** * Private helper function that retrieves a prototype's TypeInfo * and creates it if not yet created. This is used by getPrototype() and