home *** CD-ROM | disk | FTP | other *** search
/ PC Online 1999 November / PCONLINE_11_99.ISO / filesbbs / OS2 / APCHSSL2.ZIP / OS2HTTPD / jserv / com / netscape / javascript / NativeWith.class (.txt) < prev    next >
Encoding:
Java Class File  |  1999-04-09  |  3.8 KB  |  144 lines

  1. package com.netscape.javascript;
  2.  
  3. import java.lang.reflect.Method;
  4.  
  5. public class NativeWith implements Scriptable {
  6.    private Scriptable prototype;
  7.    private Scriptable parent;
  8.    private Scriptable constructor;
  9.    // $FF: synthetic field
  10.    private static Class class$com$netscape$javascript$NativeWith;
  11.  
  12.    public boolean hasInstance(Scriptable var1) {
  13.       return this.prototype.hasInstance(var1);
  14.    }
  15.  
  16.    public Object get(String var1, Scriptable var2) {
  17.       if (var2 == this) {
  18.          var2 = this.prototype;
  19.       }
  20.  
  21.       return this.prototype.get(var1, var2);
  22.    }
  23.  
  24.    public Object get(int var1, Scriptable var2) {
  25.       if (var2 == this) {
  26.          var2 = this.prototype;
  27.       }
  28.  
  29.       return this.prototype.get(var1, var2);
  30.    }
  31.  
  32.    public void put(String var1, Scriptable var2, Object var3) {
  33.       if (var2 == this) {
  34.          var2 = this.prototype;
  35.       }
  36.  
  37.       this.prototype.put(var1, var2, var3);
  38.    }
  39.  
  40.    public void put(int var1, Scriptable var2, Object var3) {
  41.       if (var2 == this) {
  42.          var2 = this.prototype;
  43.       }
  44.  
  45.       this.prototype.put(var1, var2, var3);
  46.    }
  47.  
  48.    public Object getDefaultValue(Class var1) {
  49.       return this.prototype.getDefaultValue(var1);
  50.    }
  51.  
  52.    public NativeWith() {
  53.    }
  54.  
  55.    public NativeWith(Scriptable var1, Scriptable var2) {
  56.       this.parent = var1;
  57.       this.prototype = var2;
  58.    }
  59.  
  60.    public Scriptable getPrototype() {
  61.       return this.prototype;
  62.    }
  63.  
  64.    public void setPrototype(Scriptable var1) {
  65.       this.prototype = var1;
  66.    }
  67.  
  68.    public Scriptable getParentScope() {
  69.       return this.parent;
  70.    }
  71.  
  72.    public void setParentScope(Scriptable var1) {
  73.       this.parent = var1;
  74.    }
  75.  
  76.    public static Object With(Context var0, Object[] var1, Function var2, boolean var3) {
  77.       Object[] var4 = new Object[]{"With"};
  78.       throw Context.reportRuntimeError(Context.getMessage("msg.cant.call.indirect", var4));
  79.    }
  80.  
  81.    // $FF: synthetic method
  82.    private static Class class$(String var0) {
  83.       try {
  84.          return Class.forName(var0);
  85.       } catch (ClassNotFoundException var2) {
  86.          throw new NoClassDefFoundError(((Throwable)var2).getMessage());
  87.       }
  88.    }
  89.  
  90.    public boolean has(String var1, Scriptable var2) {
  91.       if (var2 == this) {
  92.          var2 = this.prototype;
  93.       }
  94.  
  95.       return this.prototype.has(var1, var2);
  96.    }
  97.  
  98.    public boolean has(int var1, Scriptable var2) {
  99.       if (var2 == this) {
  100.          var2 = this.prototype;
  101.       }
  102.  
  103.       return this.prototype.has(var1, var2);
  104.    }
  105.  
  106.    public void delete(String var1) {
  107.       this.prototype.delete(var1);
  108.    }
  109.  
  110.    public void delete(int var1) {
  111.       this.prototype.delete(var1);
  112.    }
  113.  
  114.    public Object[] getIds() {
  115.       return this.prototype.getIds();
  116.    }
  117.  
  118.    public static void init(Scriptable var0) {
  119.       NativeWith var1 = new NativeWith();
  120.       var1.setPrototype(ScriptableObject.getObjectPrototype(var0));
  121.       Method[] var2 = FunctionObject.findMethods(class$com$netscape$javascript$NativeWith != null ? class$com$netscape$javascript$NativeWith : (class$com$netscape$javascript$NativeWith = class$("com.netscape.javascript.NativeWith")), "With");
  122.       FunctionObject var3 = new FunctionObject("With", var2[0], var0);
  123.       var3.addAsConstructor(var0, var1);
  124.    }
  125.  
  126.    public static Object newWithSpecial(Context var0, Object[] var1, Function var2, boolean var3) {
  127.       if (!var3) {
  128.          Object[] var6 = new Object[]{"With"};
  129.          throw Context.reportRuntimeError(Context.getMessage("msg.only.from.new", var6));
  130.       } else {
  131.          ScriptRuntime.checkDeprecated(var0, "With");
  132.          Scriptable var4 = ScriptableObject.getTopLevelScope(var2);
  133.          NativeWith var5 = new NativeWith();
  134.          var5.setPrototype(var1.length == 0 ? ScriptableObject.getClassPrototype(var4, "Object") : ScriptRuntime.toObject(var4, var1[0]));
  135.          var5.setParentScope(var4);
  136.          return var5;
  137.       }
  138.    }
  139.  
  140.    public String getClassName() {
  141.       return "With";
  142.    }
  143. }
  144.