KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > jdt > internal > corext > refactoring > typeconstraints > ParameterTypeVariable


1 /*******************************************************************************
2  * Copyright (c) 2000, 2006 IBM Corporation and others.
3  * All rights reserved. This program and the accompanying materials
4  * are made available under the terms of the Eclipse Public License v1.0
5  * which accompanies this distribution, and is available at
6  * http://www.eclipse.org/legal/epl-v10.html
7  *
8  * Contributors:
9  * IBM Corporation - initial API and implementation
10  *******************************************************************************/

11 package org.eclipse.jdt.internal.corext.refactoring.typeconstraints;
12
13 import org.eclipse.core.runtime.Assert;
14
15 import org.eclipse.jdt.core.dom.IMethodBinding;
16
17 import org.eclipse.jdt.internal.corext.dom.Bindings;
18
19 public class ParameterTypeVariable extends ConstraintVariable {
20
21     private final IMethodBinding fMethodBinding;
22     private final int fParameterIndex;
23     
24     public ParameterTypeVariable(IMethodBinding methodBinding, int parameterIndex) {
25         super(methodBinding.getParameterTypes()[parameterIndex]);
26         Assert.isNotNull(methodBinding);
27         Assert.isTrue(0 <= parameterIndex);
28         Assert.isTrue(parameterIndex < methodBinding.getParameterTypes().length);
29         fMethodBinding= methodBinding;
30         fParameterIndex= parameterIndex;
31     }
32     
33     /* (non-Javadoc)
34      * @see java.lang.Object#toString()
35      */

36     public String JavaDoc toString() {
37         return "[Parameter(" + fParameterIndex + "," + Bindings.asString(fMethodBinding) + ")]"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
38
}
39
40     public IMethodBinding getMethodBinding() {
41         return fMethodBinding;
42     }
43
44     public int getParameterIndex() {
45         return fParameterIndex;
46     }
47
48 }
49
Popular Tags