diff options
Diffstat (limited to 'src/main/javassist/CtField.java')
-rw-r--r-- | src/main/javassist/CtField.java | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/main/javassist/CtField.java b/src/main/javassist/CtField.java index 710f8c50..f4f2986a 100644 --- a/src/main/javassist/CtField.java +++ b/src/main/javassist/CtField.java @@ -218,6 +218,22 @@ public class CtField extends CtMember { } /** + * Returns the annotations associated with this field. + * + * @return an array of annotation-type objects. + * @see CtMember#getAnnotations() + */ + public Object[] getAnnotations() throws ClassNotFoundException { + FieldInfo fi = getFieldInfo2(); + AnnotationsAttribute ainfo = (AnnotationsAttribute) + fi.getAttribute(AnnotationsAttribute.invisibleTag); + AnnotationsAttribute ainfo2 = (AnnotationsAttribute) + fi.getAttribute(AnnotationsAttribute.visibleTag); + return CtClassType.toAnnotationType(getDeclaringClass().getClassPool(), + ainfo, ainfo2); + } + + /** * Returns the type of the field. */ public CtClass getType() throws NotFoundException { |