001 
002 /*
003  *  JScripter Standard 1.0 - To Script In Java
004  *  Copyright (C) 2008-2011  J.J.Liu<jianjunliu@126.com> <http://www.jscripter.org>
005  *  
006  *  This program is free software: you can redistribute it and/or modify
007  *  it under the terms of the GNU Affero General Public License as published by
008  *  the Free Software Foundation, either version 3 of the License, or
009  *  (at your option) any later version.
010  *  
011  *  This program is distributed in the hope that it will be useful,
012  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
013  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
014  *  GNU Affero General Public License for more details.
015  *  
016  *  You should have received a copy of the GNU Affero General Public License
017  *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
018  */
019 
020 package js.core;
021 
022 import js.*;
023 
024 /**
025  * <p>An <b>opaque</b> class representing JavaScript objects.</p>
026  *
027  * @author <a href="mailto:jianjunliu@126.com">J.J.Liu (Jianjun Liu)</a> at <a href="http://www.jscripter.org" target="_blank">http://www.jscripter.org</a>
028  * @see js.core.JsGlobal.Number#create(Object)
029  * @see jsx.core.NumberLikes
030  * 
031  * @javascript <b>Opaque</b> types can be resolved but no class objects for them can be 
032  * generated into the target codes. Re-compilers must exit with error on the operations of 
033  * accessing that kind of class objects.
034  * The <tt>checkcast</tt> operation to the class literal of this interface must be ignored 
035  * and <tt>instanceof</tt> to it always <tt>true</tt>.
036  */
037 public class JsObject extends Var<JsObject> implements ObjectLike
038 {
039     /**
040      * <p>An <b>internal</b> class containing membership data for its enclosing 
041      * opaque class.</p>
042      * <p>This class is only used inside of <b>opaque</b> or <b>internal</b> classes or 
043      * class members.</p>
044      *
045      * @author <a href="mailto:jianjunliu@126.com">J.J.Liu (Jianjun Liu)</a> at <a href="http://www.jscripter.org" target="_blank">http://www.jscripter.org</a>
046      * 
047      * @javascript Re-compilers must report error on resolving an <b>internal</b> class. 
048      */
049     protected static abstract class Members extends Var.Members
050     {
051         /**
052          * <p>An <b>internal</b> static field defining a member ID of the field name and 
053          * used internally to define a member of the same name.</p>
054          * @since 1.0
055          * @see js.Js#undefined(Object)
056          * @javascript Re-compilers must report error on accessing an <b>internal</b> field. 
057          */
058         public final static Mid undefined   = id("undefined"  );
059         /**
060          * <p>An <b>internal</b> static field defining a member ID of the field name and 
061          * used internally to define a member of the same name.</p>
062          * @since 1.0
063          * @see JsObject#constructor
064          * @javascript Re-compilers must report error on accessing an <b>internal</b> field. 
065          */
066         public final static Mid constructor = id("constructor");
067         /**
068          * <p>An <b>internal</b> static field defining a member ID of the field name and 
069          * used internally to define a member of the same name.</p>
070          * @since 1.0
071          * @see JsObject#valueOf
072          * @javascript Re-compilers must report error on accessing an <b>internal</b> field. 
073          */
074         public final static Mid valueOf     = id("valueOf"    );
075 
076         /**
077          * <p>An <b>internal</b> static field defining a member ID of the field name and 
078          * used internally to define a member of the same name.</p>
079          * @since 1.0
080          * @see JsObject#hasOwnProperty
081          * @javascript Re-compilers must report error on accessing an <b>internal</b> field. 
082          */
083         public final static Mid hasOwnProperty       = id("hasOwnProperty"      );
084         /**
085          * <p>An <b>internal</b> static field defining a member ID of the field name and 
086          * used internally to define a member of the same name.</p>
087          * @since 1.0
088          * @see JsObject#isPrototypeOf
089          * @javascript Re-compilers must report error on accessing an <b>internal</b> field. 
090          */
091         public final static Mid isPrototypeOf        = id("isPrototypeOf"       );
092         /**
093          * <p>An <b>internal</b> static field defining a member ID of the field name and 
094          * used internally to define a member of the same name.</p>
095          * @since 1.0
096          * @see JsObject#propertyIsEnumerable
097          * @javascript Re-compilers must report error on accessing an <b>internal</b> field. 
098          */
099         public final static Mid propertyIsEnumerable = id("propertyIsEnumerable");
100         /**
101          * <p>An <b>internal</b> static field defining a member ID of the field name and 
102          * used internally to define a member of the same name.</p>
103          * @since 1.0
104          * @see JsObject#toString
105          * @javascript Re-compilers must report error on accessing an <b>internal</b> field. 
106          */
107         public final static Mid toString             = id("toString"            );
108         /**
109          * <p>An <b>internal</b> static field defining a member ID of the field name and 
110          * used internally to define a member of the same name.</p>
111          * @since 1.0
112          * @see JsObject#toSource
113          * @javascript Re-compilers must report error on accessing an <b>internal</b> field. 
114          */
115         public final static Mid toSource             = id("toSource"            );
116         /**
117          * <p>An <b>internal</b> static field defining a member ID of the field name and 
118          * used internally to define a member of the same name.</p>
119          * @since 1.0
120          * @see JsObject#toLocaleString
121          * @javascript Re-compilers must report error on accessing an <b>internal</b> field. 
122          */
123         public final static Mid toLocaleString       = id("toLocaleString"      );
124     }
125 
126     /**
127      * <p>An <b>opaque</b> class representing members of its enclosing <b>opaque</b> type.</p>
128      * <p>Note that, this class is <b>opaque</b> but its constructors are all <b>internal</b>. 
129      * This class and the subclasses of this class are used to declare either <b>opaque</b> 
130      * <tt>public</tt> instance fields of the opaque type {@link js.Var.Member} or the 
131      * <b>opaque</b> <tt>public</tt> static fields of other <b>opaque</b> types while their 
132      * constructors are used to define the fields inside <b>opaque</b> classes. Under 
133      * either circumstance, the field names must be exactly same as the member names, as 
134      * the <b>opaque</b> fields of <b>opaque</b> types are resolved by re-compilers directly 
135      * based on the field names.</p>
136      *
137      * @author <a href="mailto:jianjunliu@126.com">J.J.Liu (Jianjun Liu)</a> at <a href="http://www.jscripter.org" target="_blank">http://www.jscripter.org</a>
138      * 
139      * @javascript <b>Opaque</b> types can be resolved but no class objects for them can be created 
140      * in the target codes. Re-compilers must exit with error on operations accessing that kind 
141      * of class objects.
142      * Re-compilers must resolve an <b>opaque</b> instance field declared by this class in 
143      * {@link js.Var.Member} or its subclasses to the JavaScript identifier: 
144      * <pre>q.m</pre>
145      * where <tt>m</tt> is the identifier of the field name and <tt>q</tt> is the identifier 
146      * resolved from the instance of the enclosing member. Re-compilers must resolve an 
147      * <b>opaque</b> static field declared by this class in <b>opaque</b> types other than 
148      * {@link js.Var.Member} and its subclasses to the JavaScript identifier: 
149      * <pre>m</pre>
150      * where <tt>m</tt> is the identifier of the field name. And re-compilers must report 
151      * error on the access to <b>opaque</b> fields declared by this class under any other 
152      * circumstances.
153      */
154     public static class Member extends Var.Member<Object>
155     {
156         /**
157          * <p>Internally constructs a member based on a qualifying member.</p>
158          * <p>This constructor is <b>internal</b> and only called inside of <b>opaque</b> 
159          * or <b>internal</b> classes or class members.</p>
160          * <p>Note that, this constructor is <b>internal</b> but its declaring class is 
161          * <b>opaque</b>. This constructor is used to define <b>opaque</b> instance fields 
162          * declared in the declaring class of this constructor itself or its subclasses. 
163          * Under this circumstance, the field names must be exactly same as the member 
164          * names, as the <b>opaque</b> instance fields of the <b>opaque</b> type 
165          * {@link js.Var.Member} or its subclasses are resolved by re-compilers directly 
166          * to their names appending to the name resolved from the specified qualifying 
167          * member with a dot in between.</p>
168          * @param q A qualifying member
169          * @param mid The ID of the member to construct
170          * @since 1.0
171          * @javascript Re-compilers must report error on the invocation to an <b>internal</b> constructor. 
172          */
173         public Member(Member q, Mid mid) {
174             super(q, mid);
175         }
176         /**
177          * <p>Internally constructs a member without a qualifying member.</p>
178          * <p>This constructor is <b>internal</b> and only called inside of <b>opaque</b> 
179          * or <b>internal</b> classes or class members.</p>
180          * <p>Note that, this constructor is <b>internal</b> but its declaring class is 
181          * <b>opaque</b>. This constructor is used to define <b>opaque</b> static fields, 
182          * declared in <b>opaque</b> types other than the declaring class of this constructor 
183          * itself and its subclasses. Under this circumstance, the field names must be 
184          * exactly same as the member names, as the <b>opaque</b> static fields of <b>opaque</b> 
185          * types are generally resolved by re-compilers directly to identifiers of their names.</p>
186          * @param mid The ID of the member to construct
187          * @since 1.0
188          * @javascript Re-compilers must report error on the invocation to an <b>internal</b> constructor. 
189          */
190         public Member(Mid mid) {
191             this(null, mid);
192         }
193         /**
194          * <p>Evaluates the property, represented by the current member instance, of the 
195          * argument object.</p>
196          * @param o The argument object
197          * @return The value of the current member based on the object argument.
198          * @since 1.0
199          * @javascript Re-compilers must convert the instance invocation of this method into 
200          * the JavaScript expression: 
201          * <pre>o.m</pre>
202          * where <tt>m</tt> is the identifier name resolved from the current member 
203          * instance of the invocation.
204          */
205         @Override
206         public JsObject with(ObjectLike o) {
207             return (JsObject)var(o).var(mid());
208         }
209     }
210 
211     /**
212      * <p>An <b>opaque</b> static field defining a member that is named by the field name 
213      * without a qualifying member and to access the property of the name on an object.</p>
214      * <p>The <tt>constructor</tt> property of an object is a reference to the function 
215      * that was the constructor for that object.</p>
216      * <p>A common use of the <tt>constructor</tt> property is to determine the type of unknown 
217      * objects. Given an unknown value, you can use the {@link js.Js#typeof(Object)} operation 
218      * to determine whether it is a primitive value or an object. If it is an object, you can 
219      * use the <tt>constructor</tt> property to determine what type of object it is.</p>
220      * <p>Note, however, that while this technique works for the objects built into core 
221      * JavaScript, it is not guaranteed to work with host objects such as the <tt>window</tt> 
222      * object of client-side JavaScript. The default implementation of the <tt>toString()</tt> 
223      * method provides another way to determine the type of an unknown object.</p>
224      * @since 1.0
225      * @javascript Re-compilers must resolve the member of this static field to the 
226      * identifier of the field name.
227      */
228     public final static JsFunction.Member<JsObject> constructor = new JsFunction.Member<JsObject>(Members.constructor);
229     /**
230      * <p>An <b>opaque</b> static field defining a member that is named by the field name 
231      * without a qualifying member and to access the property of the name on an object.</p>
232      * @since 1.0
233      * @see JsObject#valueOf()
234      * @javascript Re-compilers must resolve the member of this static field to the 
235      * identifier of the field name.
236      */
237     public final static JsFunction.Member<JsObject> valueOf = new JsFunction.Member<JsObject>(Members.valueOf);
238     /**
239      * <p>An <b>opaque</b> static field defining a member that is named by the field name 
240      * without a qualifying member and to access the property of the name on an object.</p>
241      * @since 1.0
242      * @see JsObject#hasOwnProperty(Object)
243      * @javascript Re-compilers must resolve the member of this static field to the 
244      * identifier of the field name.
245      */
246     public final static JsFunction.Member<Boolean> hasOwnProperty       = new JsFunction.Member<Boolean>(Members.hasOwnProperty      );
247     /**
248      * <p>An <b>opaque</b> static field defining a member that is named by the field name 
249      * without a qualifying member and to access the property of the name on an object.</p>
250      * @since 1.0
251      * @see JsObject#isPrototypeOf(Object)
252      * @javascript Re-compilers must resolve the member of this static field to the 
253      * identifier of the field name.
254      */
255     public final static JsFunction.Member<Boolean> isPrototypeOf        = new JsFunction.Member<Boolean>(Members.isPrototypeOf       );
256     /**
257      * <p>An <b>opaque</b> static field defining a member that is named by the field name 
258      * without a qualifying member and to access the property of the name on an object.</p>
259      * @since 1.0
260      * @see JsObject#propertyIsEnumerable(Object)
261      * @javascript Re-compilers must resolve the member of this static field to the 
262      * identifier of the field name.
263      */
264     public final static JsFunction.Member<Boolean> propertyIsEnumerable = new JsFunction.Member<Boolean>(Members.propertyIsEnumerable);
265     /**
266      * <p>An <b>opaque</b> static field defining a member that is named by the field name 
267      * without a qualifying member and to access the property of the name on an object.</p>
268      * @since 1.0
269      * @see JsObject#toString()
270      * @javascript Re-compilers must resolve the member of this static field to the 
271      * identifier of the field name.
272      */
273     public final static JsFunction.Member<String>  toString       = new JsFunction.Member<String> (Members.toString      );
274     /**
275      * <p>An <b>opaque</b> static field defining a member that is named by the field name 
276      * without a qualifying member and to access the property of the name on an object.</p>
277      * @since 1.0
278      * @javascript Re-compilers must resolve the member of this static field to the 
279      * identifier of the field name.
280      */
281     public final static JsFunction.Member<String>  toSource       = new JsFunction.Member<String> (Members.toSource      );
282     /**
283      * <p>An <b>opaque</b> static field defining a member that is named by the field name 
284      * without a qualifying member and to access the property of the name on an object.</p>
285      * @since 1.0
286      * @see JsObject#toLocaleString()
287      * @javascript Re-compilers must resolve the member of this static field to the 
288      * identifier of the field name.
289      */
290     public final static JsFunction.Member<String>  toLocaleString = new JsFunction.Member<String> (Members.toLocaleString);
291 
292     /**
293      * <p>An <b>internal</b> instance field keeping the actual object.</p>
294      * @since 1.0
295      * @javascript Re-compilers must report error on accessing an <b>internal</b> field. 
296      */
297     protected Object var;
298 
299     /**
300      * <p>Internally constructs an object.</p>
301      * <p>This constructor is <b>internal</b> and only called inside of <b>opaque</b> or 
302      * <b>internal</b> classes or class members.</p>
303      * @since 1.0
304      * @javascript Re-compilers must report error on the invocation to an <b>internal</b> constructor. 
305      */
306     protected JsObject(Object var) {
307         this.var = var;
308     }
309     /**
310      * <p>Casts an <b>opaque</b> object to the current <b>opaque</b> type by wrapping it 
311      * with the wrapping constructor.</p>
312      * @param var The argument of an <b>opaque</b> object.
313      * @since 1.0
314      * @javascript Re-compilers must ignore the construction operation of this constructor, 
315      * that is, replacing it with its only argument.
316      */
317     public JsObject(JsObject var) {
318         this.var = var != null ? var.var() : var;
319     }
320     /**
321      * <p>Constructs a new object.</p>
322      * @see #JsObject(JsObject)
323      * @see js.Js#object()
324      * @see js.Initializer#var()
325      * @see js.core.JsGlobal.Object#create()
326      * @see js.core.JsGlobal.Object#invoke()
327      * @since 1.0
328      * @javascript Re-compilers must replace the construction operation of this constructor 
329      * with the JavaScript expression:
330      * <pre>new Object()</pre>
331      */
332     public JsObject() {
333         this(JsGlobal.Object.with().invoke());
334     }
335 
336     /**
337      * <p>Simply returns the current object instance.</p>
338      * <p>This method is useful for JS Simulation to implement opaque types.</p>
339      * @return The current number instance.
340      * @since 1.0
341      * @javascript Re-compilers must ignore the instance invocation of this method, that is, 
342      * replacing it with its current instance.
343      */
344     @Override
345     public JsObject var() {
346         return var == null ? null : ((JsObject)var).var();
347     }
348     /**
349      * <p>Assigns the value of another object instance to the current object.</p>
350      * @param var The argument object instance.
351      * @return The new instance.
352      * @since 1.0
353      * @javascript Re-compilers must convert the instance invocation of this method into 
354      * the JavaScript expression: 
355      * <pre>o = var</pre>
356      * where <tt>o</tt> is the current instance of the invocation of this method.
357      */
358     public <T extends JsObject> T var(T var) {
359         this.var = var != null ? var.var() : var;
360         return var;
361     }
362 
363     /**
364      * <p>Converts the current object instance to a string.</p>
365      * @return A string representing the current object instance.
366      * @since 1.0
367      * @javascript Re-compilers must convert the instance invocation of this method directly 
368      * into a JavaScript invocation on its current array instance without changing the 
369      * method name, but expanding variable arguments, if any, into comma-separated values. 
370      */
371     @Override
372     public String toString() {
373         return Js.toString(var());
374     }
375 
376     /**
377      * <p>Internally calls a function member on the current object instance.</p>
378      * <p>This method is <b>internal</b> and only called inside of <b>opaque</b> or 
379      * <b>internal</b> classes or class members.</p>
380      * @param member A member of function.
381      * @return The value returned from the invocation of the function.
382      * @since 1.0
383      * @javascript Re-compilers must report error on the invocation to an <b>internal</b> method. 
384      */
385     protected <T> T call(JsFunction.Member<T> member) {
386         return var().call(member);
387     }
388     /**
389      * <p>Internally calls a function member on the current object instance, passing an 
390      * argument.</p>
391      * <p>This method is <b>internal</b> and only called inside of <b>opaque</b> or 
392      * <b>internal</b> classes or class members.</p>
393      * @param member A member of function.
394      * @param arg An argument being passed to the function to call.
395      * @return The value returned from the invocation of the function.
396      * @since 1.0
397      * @javascript Re-compilers must report error on the invocation to an <b>internal</b> method. 
398      */
399     protected <T> T call(JsFunction.Member<T> member, Object arg) {
400         return var().call(member, arg);
401     }
402     /**
403      * <p>Internally calls a function member on the current object instance, passing arguments.</p>
404      * <p>This method is <b>internal</b> and only called inside of <b>opaque</b> or 
405      * <b>internal</b> classes or class members.</p>
406      * @param member A member of function.
407      * @param args The arguments being passed to the function to call.
408      * @return The value returned from the invocation of the function.
409      * @since 1.0
410      * @javascript Re-compilers must report error on the invocation to an <b>internal</b> method. 
411      */
412     protected <T> T call(JsFunction.Member<T> member, Vars<?> args) {
413         return var().call(member, args);
414     }
415 
416     /**
417      * <p>Checks whether the current object instance has a locally defined (non-inherited) 
418      * property with a specified name.</p>
419      * <p>JavaScript objects may have properties of their own, and they may also inherit 
420      * properties from their prototype object. This method provides a way to distinguish 
421      * between inherited properties and non-inherited local properties</p>
422      * @param propname A string that contains the name of a property of the current 
423      * object instance.
424      * @return <tt>true</tt> if the current object instance has a non-inherited 
425      * property with the name specified by <tt>propname</tt>; <tt>false</tt> if 
426      * the object does not have a property with the specified name or if it inherits that 
427      * property from its prototype object.
428      * @since 1.0
429      * @javascript Re-compilers must convert the instance invocation of this method directly 
430      * into a JavaScript invocation on its current array instance without changing the 
431      * method name, but expanding variable arguments, if any, into comma-separated values. 
432      */
433     public final Boolean hasOwnProperty(Object propname) {
434         return call(hasOwnProperty, propname);
435     }
436     /**
437      * <p>Checks whether the current object instance is the prototype object of a 
438      * specified object.</p>
439      * <p>This method provides a way to determine if one Object object is the prototype 
440      * of another</p>
441      * <p>In JavaScript, Object objects inherit properties from their prototype object. 
442      * The prototype of an Object object is referred to by the prototype property of the 
443      * constructor function that creates and initializes the object.</p>
444      * <p>Not that, in JS Embed Simulation mode, this method always returns <tt>false</tt> 
445      * on a simulated object instance of {@link ObjectLike}, unless the instance is 
446      * converted to a JavaScript object by {@link ObjectLike#var()}.</p>
447      * @param other Any object.
448      * @return <tt>true</tt> if the current object instance is the prototype of 
449      * <tt>other</tt>; <tt>false</tt> if <tt>other</tt> is not an Object 
450      * object or if the current object instance is not the prototype of <tt>other</tt>.
451      * @see js.core.JsObject.Members#constructor
452      * @see js.core.JsFunction.Members#prototype
453      * @since 1.0
454      * @javascript Re-compilers must convert the instance invocation of this method directly 
455      * into a JavaScript invocation on its current array instance without changing the 
456      * method name, but expanding variable arguments, if any, into comma-separated values. 
457      */
458     public final Boolean isPrototypeOf(Object other) {
459         return call(isPrototypeOf, other);
460     }
461     /**
462      * <p>Checks whether a named property exists and would be enumerable in JavaScript.</p>
463      * @param propname A string that contains the name of a property of the current 
464      * object instance.
465      * @return <tt>true</tt> if the current object instance has a non-inherited 
466      * property with the name specified by <tt>propname</tt> and if that property is 
467      * enumerable, which means that it would be enumerated by a for/in loop on the current 
468      * object instance in JavaScript.
469      * @since 1.0
470      * @javascript Re-compilers must convert the instance invocation of this method directly 
471      * into a JavaScript invocation on its current array instance without changing the 
472      * method name, but expanding variable arguments, if any, into comma-separated values. 
473      */
474     public final Boolean propertyIsEnumerable(Object propname) {
475         return call(propertyIsEnumerable, propname);
476     }
477     /**
478      * <p>Converts the current object instance to a string, localized as appropriate 
479      * for the current locale.</p>
480      * @return A string representing the current object instance, localized as 
481      * appropriate for the current locale.
482      * @since 1.0
483      * @javascript Re-compilers must convert the instance invocation of this method directly 
484      * into a JavaScript invocation on its current array instance without changing the 
485      * method name, but expanding variable arguments, if any, into comma-separated values. 
486      */
487     public final String toLocaleString() {
488         return call(toLocaleString);
489     }
490 
491     /**
492      * <p>Checks if the current variable instance is undefined.</p>
493      * @return <tt>true</tt> if the current instance is undefined; <tt>false</tt> otherwise.
494      * @see #valueOf()
495      * @see #undefined()
496      * @since 1.0
497      * @javascript Re-compilers must convert the instance invocation of this method into the 
498      * JavaScript expression: 
499      * <pre>(v === undefined)</pre>
500      * where <tt>v</tt> is the current variable instance of the invocation.
501      */
502     @Override
503     public boolean undefined() {
504         return var() == null || var().undefined();
505     }
506 
507     /**
508      * <p>Undefines the current object instance.</p>
509      * @return <tt>true</tt> if the deletion is successful; Otherwise, <tt>false</tt>.
510      * @since 1.0
511      * @javascript Re-compilers must replace the instance invocation of this method with the 
512      * JavaScript expression:
513      * <pre>delete p</pre>
514      * where <tt>p</tt> is the current object instance of the invocation of this method.
515      */
516     public boolean delete() {
517         return var().delete();
518     }
519     /**
520      * <p>Deletes a property of the current object instance by its ID.</p>
521      * @param id The ID of the property to delete.
522      * @return <tt>true</tt> if the deletion is successful, <tt>false</tt> otherwise.
523      * @see #delete(String)
524      * @see #delete(js.Var.Member)
525      * @see #delete(js.Var.Mid)
526      * @since 1.0
527      * @javascript Re-compilers must convert the interface invocation of this method into the 
528      * JavaScript expression: 
529      * <pre>delete o.id</pre>
530      * where <tt>o</tt> is the current object instance of the invocation and <tt>id</tt> 
531      * must be resolved to a globally unique numerical property identifier at re-compile 
532      * time.
533      */
534     public boolean delete(Id<?> id) {
535         return var().delete(id);
536     }
537     /**
538      * <p>Deletes a property of the current object instance by its member ID.</p>
539      * @param mid Member ID of the property to delete.
540      * @return <tt>true</tt> if the deletion is successful, <tt>false</tt> otherwise.
541      * @see #delete(Id)
542      * @see #delete(String)
543      * @see #delete(js.Var.Member)
544      * @since 1.0
545      * @javascript Re-compilers must convert the interface invocation of this method into the 
546      * JavaScript expression: 
547      * <pre>delete o.mid</pre>
548      * where <tt>o</tt> is the current object instance of the invocation and <tt>mid</tt> 
549      * must be resolved to the property identifier at re-compile time.
550      */
551     public boolean delete(Mid mid) {
552         return var().delete(mid);
553     }
554     /**
555      * <p>Deletes a property of the current object instance by its opaque member.</p>
556      * @param m The opaque member of the property to delete.
557      * @return <tt>true</tt> if the deletion is successful, <tt>false</tt> otherwise.
558      * @see #delete(Id)
559      * @see #delete(js.Var.Mid)
560      * @see #delete(String)
561      * @since 1.0
562      * @javascript Re-compilers must convert the interface invocation of this method into the 
563      * JavaScript expression: 
564      * <pre>delete o.m</pre>
565      * where <tt>o</tt> is the current object instance of the invocation and <tt>m</tt> 
566      * must be resolved to the property identifier at re-compile time.
567      */
568     public final boolean delete(Var.Member<?> m) {
569         return delete(m.mid());
570     }
571     /**
572      * <p>Deletes a property of the current object instance by its name.</p>
573      * @param name The name of the property to delete.
574      * @return <tt>true</tt> if the deletion is successful, <tt>false</tt> otherwise.
575      * @see #delete(Id)
576      * @see #delete(js.Var.Mid)
577      * @see #delete(js.Var.Member)
578      * @since 1.0
579      * @javascript Re-compilers must convert the interface invocation of this method into the 
580      * JavaScript expression: 
581      * <pre>delete o[name]</pre>
582      * where <tt>o</tt> is the current object instance of the invocation.
583      */
584     public final boolean delete(String name) {
585         return delete(Members.id(name));
586     }
587 
588     /**
589      * <p>Gets a property of the current object instance by its ID.</p>
590      * @param id The ID of the property to get.
591      * @return The property of the current object instance specified by its ID.
592      * @see #var(js.Var.Mid)
593      * @see #var(js.Var.Member)
594      * @see #var(String)
595      * @since 1.0
596      * @javascript Re-compilers must convert the interface invocation of this method into the 
597      * JavaScript expression: 
598      * <pre>o.id</pre>
599      * where <tt>o</tt> is the current object instance of the invocation and <tt>id</tt> 
600      * must be resolved to a globally unique numerical property identifier at re-compile 
601      * time.
602      */
603     public <T> T var(Id<T> id) {
604         return var().var(id);
605     }
606     /**
607      * <p>Gets a property of the current object instance by its member ID.</p>
608      * @param mid The member ID of the property to get
609      * @return The property of the current object instance specified by its member ID.
610      * @see #var(Id)
611      * @see #var(js.Var.Member)
612      * @see #var(String)
613      * @since 1.0
614      * @javascript Re-compilers must convert the interface invocation of this method into the 
615      * JavaScript expression: 
616      * <pre>o.mid</pre>
617      * where <tt>o</tt> is the current object instance of the invocation and <tt>mid</tt> 
618      * must be resolved to the property identifier at re-compile time.
619      */
620     public Object var(Mid mid) {
621         return var().var(mid);
622     }
623     /**
624      * <p>Sets a value to the property of the current object instance by its ID.</p>
625      * @param id The ID of the property to set the <tt>value</tt>.
626      * @return The property of the current object instance specified by its ID.
627      * @param value The new value to be set.
628      * @see #var(js.Var.Mid, Object)
629      * @see #var(js.Var.Member, Object)
630      * @see #var(String, Object)
631      * @since 1.0
632      * @javascript Re-compilers must convert the interface invocation of this method into the 
633      * JavaScript expression: 
634      * <pre>o.id = value</pre>
635      * where <tt>o</tt> is the current object instance of the invocation and <tt>id</tt> 
636      * must be resolved to a globally unique numerical property identifier at re-compile 
637      * time.
638      */
639     public <T> T var(Id<T> id, T value) {
640         return var().var(id, value);
641     }
642     /**
643      * <p>Sets a value to the property of the current object instance by its member ID.</p>
644      * @param mid The member ID of the property to set the <tt>value</tt>.
645      * @param value The new value to be set.
646      * @return The property of the current object instance specified by its member ID.
647      * @see #var(Id, Object)
648      * @see #var(js.Var.Member, Object)
649      * @see #var(String, Object)
650      * @since 1.0
651      * @javascript Re-compilers must convert the interface invocation of this method into the 
652      * JavaScript expression: 
653      * <pre>o.mid = value</pre>
654      * where <tt>o</tt> is the current object instance of the invocation and <tt>mid</tt> 
655      * must be resolved to the property identifier at re-compile time.
656      */
657     public <T> T var(Mid mid, T value) {
658         return var().var(mid, value);
659     }
660     /**
661      * <p>Gets a property of the current object instance by its opaque member.</p>
662      * @param m The opaque member of the property to get.
663      * @return The property of the current object instance specified by its opaque member.
664      * @see #var(Id)
665      * @see #var(js.Var.Mid)
666      * @see #var(String)
667      * @since 1.0
668      * @javascript Re-compilers must convert the interface invocation of this method into the 
669      * JavaScript expression: 
670      * <pre>o.m</pre>
671      * where <tt>o</tt> is the current object instance of the invocation and <tt>m</tt> 
672      * must be resolved to the property identifier at re-compile time.
673      */
674     public final <T> T var(Var.Member<T> m) {
675         return m.with(this);
676     }
677     /**
678      * <p>Gets a property of the current object instance by its opaque member.</p>
679      * @param m The opaque member of the property to get.
680      * @return The property of the current object instance specified by its opaque member.
681      * @see #var(Id)
682      * @see #var(js.Var.Mid)
683      * @see #var(String)
684      * @since 1.0
685      * @javascript Re-compilers must convert the interface invocation of this method into the 
686      * JavaScript expression: 
687      * <pre>o.m</pre>
688      * where <tt>o</tt> is the current object instance of the invocation and <tt>m</tt> 
689      * must be resolved to the property identifier at re-compile time.
690      */
691     public final JsArray var(JsArray.Member m) {
692         return m.with(this);
693     }
694     /**
695      * <p>Gets a property of the current object instance by its opaque member.</p>
696      * @param m The opaque member of the property to get.
697      * @return The property of the current object instance specified by its opaque member.
698      * @see #var(Id)
699      * @see #var(js.Var.Mid)
700      * @see #var(String)
701      * @since 1.0
702      * @javascript Re-compilers must convert the interface invocation of this method into the 
703      * JavaScript expression: 
704      * <pre>o.m</pre>
705      * where <tt>o</tt> is the current object instance of the invocation and <tt>m</tt> 
706      * must be resolved to the property identifier at re-compile time.
707      */
708     public final JsBoolean var(JsBoolean.Member m) {
709         return m.with(this);
710     }
711     /**
712      * <p>Gets a property of the current object instance by its opaque member.</p>
713      * @param m The opaque member of the property to get.
714      * @return The property of the current object instance specified by its opaque member.
715      * @see #var(Id)
716      * @see #var(js.Var.Mid)
717      * @see #var(String)
718      * @since 1.0
719      * @javascript Re-compilers must convert the interface invocation of this method into the 
720      * JavaScript expression: 
721      * <pre>o.m</pre>
722      * where <tt>o</tt> is the current object instance of the invocation and <tt>m</tt> 
723      * must be resolved to the property identifier at re-compile time.
724      */
725     public final JsDate var(JsDate.Member m) {
726         return m.with(this);
727     }
728     /**
729      * <p>Gets a property of the current object instance by its opaque member.</p>
730      * @param m The opaque member of the property to get.
731      * @return The property of the current object instance specified by its opaque member.
732      * @see #var(Id)
733      * @see #var(js.Var.Mid)
734      * @see #var(String)
735      * @since 1.0
736      * @javascript Re-compilers must convert the interface invocation of this method into the 
737      * JavaScript expression: 
738      * <pre>o.m</pre>
739      * where <tt>o</tt> is the current object instance of the invocation and <tt>m</tt> 
740      * must be resolved to the property identifier at re-compile time.
741      */
742     public final <T> JsFunction<T> var(JsFunction.Member<T> m) {
743         return m.with(this);
744     }
745     /**
746      * <p>Gets a property of the current object instance by its opaque member.</p>
747      * @param m The opaque member of the property to get.
748      * @return The property of the current object instance specified by its opaque member.
749      * @see #var(Id)
750      * @see #var(js.Var.Mid)
751      * @see #var(String)
752      * @since 1.0
753      * @javascript Re-compilers must convert the interface invocation of this method into the 
754      * JavaScript expression: 
755      * <pre>o.m</pre>
756      * where <tt>o</tt> is the current object instance of the invocation and <tt>m</tt> 
757      * must be resolved to the property identifier at re-compile time.
758      */
759     public final JsNumber var(JsNumber.Member m) {
760         return m.with(this);
761     }
762     /**
763      * <p>Gets a property of the current object instance by its opaque member.</p>
764      * @param m The opaque member of the property to get.
765      * @return The property of the current object instance specified by its opaque member.
766      * @see #var(Id)
767      * @see #var(js.Var.Mid)
768      * @see #var(String)
769      * @since 1.0
770      * @javascript Re-compilers must convert the interface invocation of this method into the 
771      * JavaScript expression: 
772      * <pre>o.m</pre>
773      * where <tt>o</tt> is the current object instance of the invocation and <tt>m</tt> 
774      * must be resolved to the property identifier at re-compile time.
775      */
776     public final JsObject var(Member m) {
777         return m.with(this);
778     }
779     /**
780      * <p>Gets a property of the current object instance by its opaque member.</p>
781      * @param m The opaque member of the property to get.
782      * @return The property of the current object instance specified by its opaque member.
783      * @see #var(Id)
784      * @see #var(js.Var.Mid)
785      * @see #var(String)
786      * @since 1.0
787      * @javascript Re-compilers must convert the interface invocation of this method into the 
788      * JavaScript expression: 
789      * <pre>o.m</pre>
790      * where <tt>o</tt> is the current object instance of the invocation and <tt>m</tt> 
791      * must be resolved to the property identifier at re-compile time.
792      */
793     public final JsString var(JsString.Member m) {
794         return m.with(this);
795     }
796     /**
797      * <p>Sets a value to the property of the current object instance by its opaque member.</p>
798      * @param m The opaque member of the property to set the <tt>value</tt>.
799      * @param value The new value to be set.
800      * @return The property of the current object instance specified by its opaque member.
801      * @see #var(Id, Object)
802      * @see #var(js.Var.Mid, Object)
803      * @see #var(String, Object)
804      * @since 1.0
805      * @javascript Re-compilers must convert the interface invocation of this method into the 
806      * JavaScript expression: 
807      * <pre>o.m = value</pre>
808      * where <tt>o</tt> is the current object instance of the invocation and <tt>m</tt> 
809      * must be resolved to the property identifier at re-compile time.
810      */
811     public final <T> T var(Var.Member<T> m, T value) {
812         return m.var(this).var(m.mid(), value);
813     }
814     /**
815      * <p>Gets a property of the current object instance by its name.</p>
816      * @param name The name of the property to get.
817      * @return The property of the current object instance specified by its name.
818      * @see #var(Id)
819      * @see #var(js.Var.Mid)
820      * @see #var(js.Var.Member)
821      * @since 1.0
822      * @javascript Re-compilers must convert the interface invocation of this method into the 
823      * JavaScript expression: 
824      * <pre>o[name]</pre>
825      * where <tt>o</tt> is the current object instance of the invocation.
826      */
827     public final Object var(String name) {
828         return var(Members.id(name));
829     }
830     /**
831      * <p>Sets a value to the property of the current object instance by its name.</p>
832      * @param name The name of the property to set the <tt>value</tt>.
833      * @param value The new value to be set.
834      * @return The property of the current object instance specified by its name.
835      * @see #var(Id, Object)
836      * @see #var(js.Var.Mid, Object)
837      * @see #var(js.Var.Member, Object)
838      * @since 1.0
839      * @javascript Re-compilers must convert the interface invocation of this method into the 
840      * JavaScript expression: 
841      * <pre>o[name] = value</pre>
842      * where <tt>o</tt> is the current object instance of the invocation.
843      */
844     public final <T> T var(String name, T value) {
845         return var(Members.id(name), value);
846     }
847 }