1 11 package org.eclipse.jdt.internal.corext.refactoring.typeconstraints; 12 13 import org.eclipse.core.runtime.Assert; 14 15 import org.eclipse.jdt.core.ICompilationUnit; 16 import org.eclipse.jdt.core.dom.ITypeBinding; 17 import org.eclipse.jdt.core.dom.Type; 18 19 import org.eclipse.jdt.internal.corext.dom.ASTNodes; 20 21 public final class TypeVariable extends ConstraintVariable { 22 23 private final String fSource; 24 private final CompilationUnitRange fTypeRange; 25 26 public TypeVariable(Type type){ 27 super(type.resolveBinding()); 28 fSource= type.toString(); 29 ICompilationUnit cu= ASTCreator.getCu(type); 30 Assert.isNotNull(cu); 31 fTypeRange= new CompilationUnitRange(cu, ASTNodes.getElementType(type)); 32 } 33 34 public TypeVariable(ITypeBinding binding, String source, CompilationUnitRange range){ 35 super(binding); 36 fSource= source; 37 fTypeRange= range; 38 } 39 40 43 public String toString() { 44 return fSource; 45 } 46 47 public CompilationUnitRange getCompilationUnitRange() { 48 return fTypeRange; 49 } 50 } 51 | Popular Tags |