KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > google > gwt > dev > jjs > ast > js > JsniMethod


1 /*
2  * Copyright 2007 Google Inc.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License"); you may not
5  * use this file except in compliance with the License. You may obtain a copy of
6  * the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12  * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13  * License for the specific language governing permissions and limitations under
14  * the License.
15  */

16 package com.google.gwt.dev.jjs.ast.js;
17
18 import com.google.gwt.dev.jjs.SourceInfo;
19 import com.google.gwt.dev.jjs.ast.Context;
20 import com.google.gwt.dev.jjs.ast.JMethod;
21 import com.google.gwt.dev.jjs.ast.JProgram;
22 import com.google.gwt.dev.jjs.ast.JReferenceType;
23 import com.google.gwt.dev.jjs.ast.JType;
24 import com.google.gwt.dev.jjs.ast.JVisitor;
25 import com.google.gwt.dev.js.ast.JsFunction;
26
27 import java.util.ArrayList JavaDoc;
28 import java.util.List JavaDoc;
29
30 /**
31  * A Java native method that is implemented in JSNI code.
32  */

33 public class JsniMethod extends JMethod {
34
35   public final List JavaDoc/* <JsniFieldRef> */jsniFieldRefs = new ArrayList JavaDoc/* <JsniFieldRef> */();
36   public final List JavaDoc/* <JsniMethodRef> */jsniMethodRefs = new ArrayList JavaDoc/* <JsniMethodRef> */();
37   private JsFunction jsFunction = null;
38
39   public JsniMethod(JProgram program, SourceInfo info,
40       String JavaDoc name, JReferenceType enclosingType, JType returnType,
41       boolean isStatic, boolean isFinal, boolean isPrivate) {
42     super(program, info, name, enclosingType, returnType, false, isStatic,
43         isFinal, isPrivate);
44   }
45
46   public JsFunction getFunc() {
47     assert (this.jsFunction != null);
48     return jsFunction;
49   }
50
51   public boolean isNative() {
52     return true;
53   }
54
55   public void setFunc(JsFunction jsFunction) {
56     assert (this.jsFunction == null);
57     this.jsFunction = jsFunction;
58   }
59
60   public void traverse(JVisitor visitor, Context ctx) {
61     if (visitor.visit(this, ctx)) {
62       visitor.accept(params);
63       visitor.accept(jsniFieldRefs);
64       visitor.accept(jsniMethodRefs);
65     }
66     visitor.endVisit(this, ctx);
67   }
68
69 }
70
Popular Tags