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;
18 * Element info for IMethod elements.
20 /* package */ class SourceMethodElementInfo extends MemberElementInfo implements ISourceMethod {
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,
25 * in the order the parameters are delcared. For a binary method (that is,
26 * a method declared in a binary type), these names are invented as
27 * "arg"i where i starts at 1. This is an empty array if this method
30 protected char[][] argumentNames;
33 * Collection of type names for the arguments in this
34 * method, in the order they are declared. This is an empty
35 * array for a method with no arguments. A name is a simple
36 * name or a qualified, dot separated name.
37 * For example, Hashtable or java.util.Hashtable.
39 protected char[][] argumentTypeNames;
42 * Return type name for this method. The return type of
43 * constructors is equivalent to void.
45 protected char[] returnType;
48 * A collection of type names of the exceptions this
49 * method throws, or an empty collection if this method
50 * does not declare to throw any exceptions. A name is a simple
51 * name or a qualified, dot separated name.
52 * For example, Hashtable or java.util.Hashtable.
54 protected char[][] exceptionTypes;
59 protected boolean isConstructor= false;
60 public char[][] getArgumentNames() {
61 return this.argumentNames;
63 public char[][] getArgumentTypeNames() {
64 return this.argumentTypeNames;
66 public char[][] getExceptionTypeNames() {
67 return this.exceptionTypes;
69 public char[] getReturnTypeName() {
70 return this.returnType;
72 public char[] getSelector() {
75 protected String getSignature() {
77 String[] paramSignatures = new String[this.argumentTypeNames.length];
78 for (int i = 0; i < this.argumentTypeNames.length; ++i) {
79 paramSignatures[i] = Signature.createTypeSignature(this.argumentTypeNames[i], false);
81 return Signature.createMethodSignature(paramSignatures, Signature.createTypeSignature(this.returnType, false));
83 public boolean isConstructor() {
84 return this.isConstructor;
86 protected void setArgumentNames(char[][] names) {
87 this.argumentNames = names;
89 protected void setArgumentTypeNames(char[][] types) {
90 this.argumentTypeNames = types;
92 protected void setConstructor(boolean isConstructor) {
93 this.isConstructor = isConstructor;
95 protected void setExceptionTypeNames(char[][] types) {
96 this.exceptionTypes = types;
98 protected void setReturnType(char[] type) {
99 this.returnType = type;