/** * Returns an array of ids for the properties of the object. * * <p>Any properties with the attribute DONTENUM are not listed. <p> * * @return an array of java.lang.Objects with an entry for every * listed property. Properties accessed via an integer index will * have a corresponding * Integer entry in the returned array. Properties accessed by * a String will have a String entry in the returned array. */ public Object[] getIds() { return getIds(false); }
/** * Returns an array of ids for the properties of the object. * * <p>All properties, even those with attribute DONTENUM, are listed. <p> * * @return an array of java.lang.Objects with an entry for every * listed property. Properties accessed via an integer index will * have a corresponding * Integer entry in the returned array. Properties accessed by * a String will have a String entry in the returned array. */ public Object[] getAllIds() { return getIds(true); }
@Override public Iterator<Object> iterator() { return new Iterator<Object>() { Object[] ids = getIds(); Object key; int index = 0; public boolean hasNext() { return index < ids.length; } public Object next() { return (key = ids[index++]); } public void remove() { if (key == null) { throw new IllegalStateException(); } ScriptableObject.this.remove(key); key = null; } }; }
@Override public Iterator<Object> iterator() { return new Iterator<Object>() { Object[] ids = getIds(); Object key; int index = 0; public boolean hasNext() { return index < ids.length; } public Object next() { return get((key = ids[index++])); } public void remove() { if (key == null) { throw new IllegalStateException(); } ScriptableObject.this.remove(key); key = null; } }; }
@Override public Object[] getIds() { if (this == thePrototypeInstance) return super.getIds(); return collectIds(); }
if (o instanceof ScriptableObject) { final ScriptableObject obj = (ScriptableObject) o; final Object[] ids = obj.getIds(); if (ids != null && ids.length > 0) { final StringBuilder sb = new StringBuilder();
if (o instanceof ScriptableObject) { final ScriptableObject obj = (ScriptableObject) o; final Object[] ids = obj.getIds(); if (ids != null && ids.length > 0) { final StringBuilder sb = new StringBuilder();
@Override Object[] getIds(boolean getAll) Object[] result = super.getIds(getAll);
public void defineOwnProperties(Context cx, ScriptableObject props) { Object[] ids = props.getIds(); for (Object id : ids) { String name = ScriptRuntime.toString(id); Object descObj = props.get(id); ScriptableObject desc = ensureScriptableObject(descObj); checkValidPropertyDefinition(getSlot(name, 0, SLOT_QUERY), desc); } for (Object id : ids) { String name = ScriptRuntime.toString(id); ScriptableObject desc = (ScriptableObject) props.get(id); defineOwnProperty(cx, name, desc, false); } }