1 /*******************************************************************************
2 * Copyright (c) 2000, 2003 IBM Corporation and others.
3 * All rights reserved. This program and the accompanying materials
4 * are made available under the terms of the Common Public License v1.0
5 * which accompanies this distribution, and is available at
6 * http://www.eclipse.org/legal/cpl-v10.html
9 * IBM Corporation - initial API and implementation
10 *******************************************************************************/
11 package net.sourceforge.phpdt.internal.core;
13 import net.sourceforge.phpdt.core.Signature;
14 import net.sourceforge.phpdt.internal.compiler.env.ISourceMethod;
17 * Element info for IMethod elements.
19 /* package */class SourceMethodElementInfo extends MemberElementInfo implements
23 * For a source method (that is, a method contained in a compilation unit)
24 * this is a collection of the names of the parameters for this method, in
25 * the order the parameters are delcared. For a binary method (that is, a
26 * method declared in a binary type), these names are invented as "arg"i
27 * where i starts at 1. This is an empty array if this method has no
30 protected char[][] argumentNames;
33 * Collection of type names for the arguments in this method, in the order
34 * they are declared. This is an empty array for a method with no arguments.
35 * A name is a simple name or a qualified, dot separated name. For example,
36 * Hashtable or java.util.Hashtable.
38 protected char[][] argumentTypeNames;
41 * Return type name for this method. The return type of constructors is
44 protected char[] returnType;
47 * A collection of type names of the exceptions this method throws, or an
48 * empty collection if this method does not declare to throw any exceptions.
49 * A name is a simple name or a qualified, dot separated name. For example,
50 * Hashtable or java.util.Hashtable.
52 protected char[][] exceptionTypes;
57 protected boolean isConstructor = false;
59 public char[][] getArgumentNames() {
60 return this.argumentNames;
63 public char[][] getArgumentTypeNames() {
64 return this.argumentTypeNames;
67 public char[][] getExceptionTypeNames() {
68 return this.exceptionTypes;
71 public char[] getReturnTypeName() {
72 return this.returnType;
75 public char[] getSelector() {
79 protected String getSignature() {
81 String[] paramSignatures = new String[this.argumentTypeNames.length];
82 for (int i = 0; i < this.argumentTypeNames.length; ++i) {
83 paramSignatures[i] = Signature.createTypeSignature(
84 this.argumentTypeNames[i], false);
86 return Signature.createMethodSignature(paramSignatures, Signature
87 .createTypeSignature(this.returnType, false));
90 public boolean isConstructor() {
91 return this.isConstructor;
94 protected void setArgumentNames(char[][] names) {
95 this.argumentNames = names;
98 protected void setArgumentTypeNames(char[][] types) {
99 this.argumentTypeNames = types;
102 protected void setConstructor(boolean isConstructor) {
103 this.isConstructor = isConstructor;
106 protected void setExceptionTypeNames(char[][] types) {
107 this.exceptionTypes = types;
110 protected void setReturnType(char[] type) {
111 this.returnType = type;