1 32 package net.sf.retrotranslator.runtime.impl; 33 34 import java.lang.reflect.*; 35 36 39 public class TypeVariableImpl implements TypeVariable { 40 41 private GenericDeclaration genericDeclaration; 42 private String name; 43 private LazyList<TypeDescriptor, Type> bounds; 44 45 public TypeVariableImpl(GenericDeclaration genericDeclaration, String name, LazyList<TypeDescriptor, Type> bounds) { 46 this.genericDeclaration = genericDeclaration; 47 this.name = name; 48 this.bounds = bounds; 49 } 50 51 public Type[] getBounds() { 52 return bounds.getClone(); 53 } 54 55 public GenericDeclaration getGenericDeclaration() { 56 return genericDeclaration; 57 } 58 59 public String getName() { 60 return name; 61 } 62 63 public int hashCode() { 64 return genericDeclaration.hashCode() ^ name.hashCode(); 65 } 66 67 public boolean equals(Object obj) { 68 if (obj instanceof TypeVariable) { 69 if (obj == this) return true; 70 TypeVariable variable = ((TypeVariable) obj); 71 return genericDeclaration.equals(variable.getGenericDeclaration()) && name.equals(variable.getName()); 72 } 73 return false; 74 } 75 76 public String toString() { 77 return name; 78 } 79 80 } 81 | Popular Tags |