Implement getPrototypeProperties(String) to get a SystemMap containing the

scripted properties of a prototype.
This commit is contained in:
hns 2005-08-12 13:27:26 +00:00
parent 3b2a106503
commit 97c5399c9b

View file

@ -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