Class JS5Object
- java.lang.Object
-
- org.fife.rsta.ac.js.ecma.api.ecma3.JSObject
-
- org.fife.rsta.ac.js.ecma.api.ecma5.JS5Object
-
- All Implemented Interfaces:
JSObjectFunctions,JS5ObjectFunctions
public abstract class JS5Object extends JSObject implements JS5ObjectFunctions
Base JavaScript Object- Since:
- Standard ECMA-262 3rd. Edition
-
-
Field Summary
-
Fields inherited from class org.fife.rsta.ac.js.ecma.api.ecma3.JSObject
constructor, prototype
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static JS5Objectcreate(JS5Object proto, JS5Object descriptors)function create(proto, descriptors) create an object with specified prototype and properties.static JS5ObjectdefineProperties(JS5Object o, JS5Object descriptors)function defineProperties(o, descriptors) create or configure multiple object properties.static JS5ObjectdefineProperty(JS5Object o, JS5String name, JS5Object desc)function defineProperty(o, name, desc) create or configure an object property.static JS5Objectfreeze(JS5Object o)function freeze(o) make an object immutable.static JS5ObjectgetOwnPropertyDescriptor(JS5Object o, JS5String name)function getOwnPropertyDescriptor(o, name) query property attributes.static JS5ArraygetOwnPropertyNames(JS5Object o)function getOwnPropertyNames(o) return the names of non-inherited properties.static JS5ObjectgetPrototypeOf(JS5Object o)function getPrototypeOf(o) return the prototype of an objectstatic JSBooleanisExtensible(JS5Object o)function isExtensible(o) can new properties be added to an object?static JSBooleanisFrozen(JS5Object o)function isFrozen(o) is an object immutable?static JSBooleanisSealed(JS5Object o)function isSealed(o) can properties be added or deleted from an object?static JS5Arraykeys(JS5Object o)function keys(o) return enumerable property names.static JS5ObjectpreventExtensions(JS5Object o)function preventExtensions(o) don't allow new properties on an object.static JS5Objectseal(JS5Object o)function seal(o) prevent the addition or deletion of properties.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.fife.rsta.ac.js.ecma.api.ecma3.functions.JSObjectFunctions
hasOwnProperty, isPrototypeOf, propertyIsEnumerable, toLocaleString, toString, valueOf
-
-
-
-
Constructor Detail
-
JS5Object
public JS5Object()
Object Object()Creates a new object instance
- Since:
- Standard ECMA-262 3rd. Edition, Level 2 Document Object Model Core Definition.
-
JS5Object
public JS5Object(JSObject value)
Object Object(value)- Parameters:
value- optional argument specifies a primitive JavaScript value - a number, boolean etc..- Since:
- Standard ECMA-262 3rd. Edition, Level 2 Document Object Model Core Definition.
-
-
Method Detail
-
create
public static JS5Object create(JS5Object proto, JS5Object descriptors)
function create(proto, descriptors) create an object with specified prototype and properties.Example
var p = Object.create({z:0}), { x: { value: 1, writable, false, enumerable:true. configurable:true}, y: { value: 2, writable, false, enumerable:true. configurable:true}, });- Parameters:
proto- The prototype of the newly created object, or null.descriptors- An optional object that maps property names to property descriptors.- Since:
- Standard ECMA-262 5th. Edition
- See Also:
Object,defineProperty(),defineProperties(),getOwnPropertyDescriptor()
-
defineProperties
public static JS5Object defineProperties(JS5Object o, JS5Object descriptors)
function defineProperties(o, descriptors) create or configure multiple object properties.Example
var p = Object.defineProperties({}), { x: { value: 1, writable, false, enumerable:true. configurable:true}, y: { value: 2, writable, false, enumerable:true. configurable:true}, });- Parameters:
o- The object on which properties are to be created or configured.descriptors- An object that maps property names to property descriptors.- Since:
- Standard ECMA-262 5th. Edition
- See Also:
Object,create(),defineProperty(),getOwnPropertyDescriptor()
-
defineProperty
public static JS5Object defineProperty(JS5Object o, JS5String name, JS5Object desc)
function defineProperty(o, name, desc) create or configure an object property.Example
function constant(o, n, v) { //define a constant with value v Object.defineProperty (o, n, { value: v, writable, false, enumerable:true. configurable:true}); }- Parameters:
o- The object on which a property is to be created or configured.name- The name of the property created or configured.desc- A property descriptor object that describes the new property.- Since:
- Standard ECMA-262 5th. Edition
- See Also:
Object
-
freeze
public static JS5Object freeze(JS5Object o)
function freeze(o) make an object immutable.- Parameters:
o- The object to be frozen.- Since:
- Standard ECMA-262 5th. Edition
- See Also:
Object,defineProperty(),isFrozen(),preventExtensions(),seal()
-
getOwnPropertyDescriptor
public static JS5Object getOwnPropertyDescriptor(JS5Object o, JS5String name)
function getOwnPropertyDescriptor(o, name) query property attributes.- Parameters:
o- The object that is to have its property attributes queried.name- The name of the property to query.- Since:
- Standard ECMA-262 5th. Edition
- See Also:
Object,defineProperty()
-
getOwnPropertyNames
public static JS5Array getOwnPropertyNames(JS5Object o)
function getOwnPropertyNames(o) return the names of non-inherited properties.Example
Object.getOwnPropertyNames([]); //returns [length]: "length" is non enumerable
-
getPrototypeOf
public static JS5Object getPrototypeOf(JS5Object o)
function getPrototypeOf(o) return the prototype of an objectExample
var p = {}; //create object Object.getPrototypeOf(p); //=> Object.prototype var o = Object.create(p); //an object inherited from p Object.getPrototypeOf(o); //=> p
-
isExtensible
public static JSBoolean isExtensible(JS5Object o)
function isExtensible(o) can new properties be added to an object?Example
var o = {}; //create object Object.isExtensible(o); //=> true Object.preventExtensions(o); //Make it non-extensible Object.isExtensible(o); //=> false- Parameters:
o- The object to be checked for extensibility- Since:
- Standard ECMA-262 5th. Edition
- See Also:
Object
-
isFrozen
public static JSBoolean isFrozen(JS5Object o)
function isFrozen(o) is an object immutable?- Parameters:
o- The object to be checked.- Since:
- Standard ECMA-262 5th. Edition
- See Also:
Object,defineProperty(),freeze(),isExtensible(),isSealed(),preventExtensions(),seal()
-
isSealed
public static JSBoolean isSealed(JS5Object o)
function isSealed(o) can properties be added or deleted from an object?- Parameters:
o- The object to be checked.- Since:
- Standard ECMA-262 5th. Edition
- See Also:
Object,defineProperty(),freeze(),isExtensible(),isFrozen(),preventExtensions(),seal()
-
keys
public static JS5Array keys(JS5Object o)
function keys(o) return enumerable property names. ExampleObject.keys({x:1, y:2}); // => ["x", "y"]- Parameters:
o- an object- Since:
- Standard ECMA-262 5th. Edition
- See Also:
Object,getOwnPropertyNames()
-
preventExtensions
public static JS5Object preventExtensions(JS5Object o)
function preventExtensions(o) don't allow new properties on an object.- Parameters:
o- The object is to have its extensibility attribute set.- Since:
- Standard ECMA-262 5th. Edition
- See Also:
Object,freeze(),isExtensible(),seal()
-
seal
public static JS5Object seal(JS5Object o)
function seal(o) prevent the addition or deletion of properties.- Parameters:
o- The object to be sealed.- Since:
- Standard ECMA-262 5th. Edition
- See Also:
Object,defineProperty(),freeze(),isSealed(),preventExtensions()
-
-