1 12 package org.aspectj.internal.lang.reflect; 13 14 import java.lang.reflect.Field ; 15 import java.lang.reflect.Type ; 16 17 import org.aspectj.lang.reflect.AjType; 18 import org.aspectj.lang.reflect.AjTypeSystem; 19 import org.aspectj.lang.reflect.InterTypeFieldDeclaration; 20 21 25 public class InterTypeFieldDeclarationImpl extends InterTypeDeclarationImpl 26 implements InterTypeFieldDeclaration { 27 28 private String name; 29 private AjType<?> type; 30 private Type genericType; 31 32 37 public InterTypeFieldDeclarationImpl(AjType<?> decType, String target, 38 int mods, String name, AjType<?> type, Type genericType) { 39 super(decType, target, mods); 40 this.name = name; 41 this.type = type; 42 this.genericType = genericType; 43 } 44 45 public InterTypeFieldDeclarationImpl(AjType<?> decType, AjType<?> targetType, Field base) { 46 super(decType,targetType,base.getModifiers()); 47 this.name = base.getName(); 48 this.type = AjTypeSystem.getAjType(base.getType()); 49 Type gt = base.getGenericType(); 50 if (gt instanceof Class ) { 51 this.genericType = AjTypeSystem.getAjType((Class <?>)gt); 52 } else { 53 this.genericType = gt; 54 } 55 } 56 57 60 public String getName() { 61 return this.name; 62 } 63 64 67 public AjType<?> getType() { 68 return this.type; 69 } 70 71 74 public Type getGenericType() { 75 return this.genericType; 76 } 77 78 public String toString() { 79 StringBuffer sb = new StringBuffer (); 80 sb.append(java.lang.reflect.Modifier.toString(getModifiers())); 81 sb.append(" "); 82 sb.append(getType().toString()); 83 sb.append(" "); 84 sb.append(this.targetTypeName); 85 sb.append("."); 86 sb.append(getName()); 87 return sb.toString(); 88 } 89 90 } 91 | Popular Tags |