1 package spoon.support.reflect.reference; 2 3 import java.lang.annotation.Annotation ; 4 import java.util.ArrayList ; 5 import java.util.List ; 6 7 import spoon.reflect.reference.CtTypeParameterReference; 8 import spoon.reflect.reference.CtTypeReference; 9 import spoon.reflect.visitor.CtVisitor; 10 11 public class CtTypeParameterReferenceImpl extends CtTypeReferenceImpl<Object > 12 implements CtTypeParameterReference { 13 private static final long serialVersionUID = 1L; 14 15 List <CtTypeReference> bounds = new ArrayList <CtTypeReference>(); 16 17 boolean upper = true; 18 19 public CtTypeParameterReferenceImpl() { 20 super(); 21 } 22 23 @Override 24 public void accept(CtVisitor visitor) { 25 visitor.visitCtTypeParameterReference(this); 26 } 27 28 @Override 29 public <A extends Annotation > A getAnnotation(Class <A> annotationType) { 30 return null; 31 } 32 33 public List <CtTypeReference> getBounds() { 34 return bounds; 35 } 36 37 public boolean isUpper() { 38 return upper; 39 } 40 41 public void setBounds(List <CtTypeReference> bounds) { 42 this.bounds = bounds; 43 } 44 45 public void setUpper(boolean upper) { 46 this.upper = upper; 47 } 48 49 @Override 50 public boolean isAssignableFrom(CtTypeReference<?> type) { 51 return false; 52 } 53 54 @Override 55 public boolean isSubtypeOf(CtTypeReference<?> type) { 56 return false; 57 } 58 59 @Override 60 public boolean isPrimitif() { 61 return false; 62 } 63 64 public void setSimpleName(String simplename) { 65 this.simplename = simplename; 66 } 67 68 @SuppressWarnings ("unchecked") 69 public Class <Object > getActualClass() { 70 if(isUpper()) { 71 if(getBounds().isEmpty()) { 72 return Object .class; 73 } else { 74 return (Class )getBounds().get(0).getActualClass(); 75 } 76 } 77 return null; 78 } 79 80 } 81 | Popular Tags |