KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > google > gwt > core > ext > typeinfo > JParameter


1 /*
2  * Copyright 2006 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.core.ext.typeinfo;
17
18 /**
19  * Represents a parameter in a declaration.
20  */

21 public class JParameter implements HasMetaData {
22
23   private final HasMetaData metaData = new MetaData();
24
25   private final String JavaDoc name;
26
27   private JType type;
28
29   private final JAbstractMethod enclosingMethod;
30
31   public JParameter(JAbstractMethod enclosingMethod, JType type, String JavaDoc name) {
32     this.enclosingMethod = enclosingMethod;
33     this.type = type;
34     this.name = name;
35
36     enclosingMethod.addParameter(this);
37   }
38
39   public void addMetaData(String JavaDoc tagName, String JavaDoc[] values) {
40     metaData.addMetaData(tagName, values);
41   }
42
43   public JAbstractMethod getEnclosingMethod() {
44     return enclosingMethod;
45   }
46
47   public String JavaDoc[][] getMetaData(String JavaDoc tagName) {
48     return metaData.getMetaData(tagName);
49   }
50
51   public String JavaDoc[] getMetaDataTags() {
52     return metaData.getMetaDataTags();
53   }
54
55   public String JavaDoc getName() {
56     return name;
57   }
58
59   public JType getType() {
60     return type;
61   }
62
63   public String JavaDoc toString() {
64     StringBuffer JavaDoc sb = new StringBuffer JavaDoc();
65     sb.append(type.getQualifiedSourceName());
66     sb.append(" ");
67     sb.append(getName());
68     return sb.toString();
69   }
70
71   // Called when parameter types are found to be parameterized
72
void setType(JType type) {
73     this.type = type;
74   }
75 }
76
Popular Tags