Implement getPrototypeProperties(String) to get a SystemMap containing the
scripted properties of a prototype.
This commit is contained in:
parent
3b2a106503
commit
97c5399c9b
1 changed files with 19 additions and 0 deletions
|
@ -419,6 +419,25 @@ public final class RhinoCore implements ScopeProvider {
|
||||||
return type == null ? null : type.objProto;
|
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
|
* Private helper function that retrieves a prototype's TypeInfo
|
||||||
* and creates it if not yet created. This is used by getPrototype() and
|
* and creates it if not yet created. This is used by getPrototype() and
|
||||||
|
|
Loading…
Add table
Reference in a new issue