Debian Codegraph @

rhino/src/org/mozilla/javascript/NativeJavaConstructor.java

raw symbols SCIP
1 /* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
2 *
3 * This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this
5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6
7 package org.mozilla.javascript;
8
9 /**
10 * This class reflects a single Java constructor into the JavaScript
11 * environment. It satisfies a request for an overloaded constructor,
12 * as introduced in LiveConnect 3.
13 * All NativeJavaConstructors behave as JSRef `bound' methods, in that they
14 * always construct the same NativeJavaClass regardless of any reparenting
15 * that may occur.
16 *
17 * @author Frank Mitchell
18 * @see NativeJavaMethod
19 * @see NativeJavaPackage
20 * @see NativeJavaClass
21 */
22
23 public class NativeJavaConstructor extends BaseFunction
24 {
25 static final long serialVersionUID = -8149253217482668463L;
26
27 MemberBox ctor;
28
29 public NativeJavaConstructor(MemberBox ctor)
30 {
31 this.ctor = ctor;
32 }
33
34 @Override
35 public Object call(Context cx, Scriptable scope, Scriptable thisObj,
36 Object[] args)
37 {
38 return NativeJavaClass.constructSpecific(cx, scope, args, ctor);
39 }
40
41 @Override
42 public String getFunctionName()
43 {
44 String sig = JavaMembers.liveConnectSignature(ctor.argTypes);
45 return "<init>".concat(sig);
46 }
47
48 @Override
49 public String toString()
50 {
51 return "[JavaConstructor " + ctor.getName() + "]";
52 }
53 }
54