1 22 package org.jboss.reflect.plugins.javassist; 23 24 import org.jboss.reflect.plugins.AnnotationHelper; 25 import org.jboss.reflect.spi.AnnotationValue; 26 import org.jboss.reflect.spi.ParameterInfo; 27 import org.jboss.reflect.spi.TypeInfo; 28 import org.jboss.util.JBossStringBuilder; 29 30 36 public class JavassistParameterInfo extends JavassistAnnotatedInfo implements ParameterInfo 37 { 38 39 private JavassistAnnotatedParameterInfo annotated; 40 41 42 private String name; 43 44 45 private TypeInfo parameterType; 46 47 55 public JavassistParameterInfo(AnnotationHelper annotationHelper, JavassistAnnotatedParameterInfo annotated, int index, TypeInfo parameterType) 56 { 57 super(annotationHelper); 58 this.annotated = annotated; 59 this.name = "arg" + index; 60 this.parameterType = parameterType; 61 } 62 63 68 protected JavassistAnnotatedInfo getAnnotated() 69 { 70 return annotated; 71 } 72 73 public String getName() 74 { 75 return name; 76 } 77 78 public TypeInfo getParameterType() 79 { 80 return parameterType; 81 } 82 83 public boolean equals(Object obj) 84 { 85 if (this == obj) 86 return true; 87 if (obj == null || obj instanceof ParameterInfo == false) 88 return false; 89 90 ParameterInfo other = (ParameterInfo) obj; 91 return parameterType.equals(other.getParameterType()); 92 } 93 94 protected int getHashCode() 95 { 96 return getName().hashCode(); 97 } 98 99 public void toShortString(JBossStringBuilder buffer) 100 { 101 buffer.append(getParameterType()); 102 } 103 104 protected void toString(JBossStringBuilder buffer) 105 { 106 buffer.append("type=").append(getParameterType()); 107 super.toString(buffer); 108 } 109 110 public AnnotationValue[] getAnnotations() 111 { 112 if (annotationsArray == NOT_CONFIGURED) 113 { 114 annotated.createParameterAnnotations(); } 116 return annotationsArray; 117 } 118 119 public void setAnnotations(AnnotationValue[] annotations) 120 { 121 annotationsArray = annotations; 122 setupAnnotations(annotations); 123 } 124 125 } 126 | Popular Tags |